From zero to twenty seats and back again in two years
- Here's a breakdown of the HTML snippet you provided, focusing on the image information:
- This code represents a responsive image element, likely part of a news article or webpage on the NOS (Dutch Broadcasting Foundation) website.
- * : A semantic HTML element used to group content (in this case, the image) along with a caption or other related elements.
Here’s a breakdown of the HTML snippet you provided, focusing on the image information:
Overall Structure
This code represents a responsive image element, likely part of a news article or webpage on the NOS (Dutch Broadcasting Foundation) website. It’s designed to display an image that adapts to different screen sizes.
Key Components
* <figure>: A semantic HTML element used to group content (in this case, the image) along with a caption or other related elements.
* <button>: A button to open the image in fullscreen.
* <picture>: This is the core of the responsive image implementation. It allows the browser to choose the most appropriate image source based on the screen size and resolution.
* <source>: Inside the <picture> element, each <source> tag specifies an image source for a particular media condition (screen width).
* media="(max-width: 37.5rem)": This source is used when the screen width is 37.5rem or less (rem is a relative unit based on the root font size).
* sizes="(min-width: 786px) 786px, 100vw": This attribute tells the browser how the image will be displayed at different viewport sizes.
* srcset="...": This attribute provides a list of image URLs along with their widths (e.g., 128x72a.jpg 96w). The browser uses this information to select the most efficient image to download.
* <img>: The final <img> tag is a fallback for browsers that don’t support the <picture> element. It also contains the alt attribute.
Image URLs and Sizes
The code provides a series of image URLs with different resolutions:
* 128x72a.jpg (96w)
* 256x144a.jpg (192w)
* 384x216a.jpg (288w)
* 512x288a.jpg (384w)
* 640x360a.jpg (480w)
* 768x432a.jpg (576w)
* 1024x576a.jpg (768w)
* 1280x720a.jpg (960w)
* 1536x864a.jpg (1152w)
* 1920x1080a.jpg (1440w)
* 2560x1440a.jpg (1920w)
* 3200x1800a.jpg (2400w)
* 3840x2160a.jpg (2880w)
alt Attribute
The alt attribute is incomplete in the provided snippet.It starts with alt= but doesn’t have a value. The alt attribute is crucial for accessibility (screen readers) and SEO. It should contain a descriptive text of the image.
In Summary
This HTML code defines a responsive image that will automatically scale and display the most appropriate version based on the user’s device and screen size. The image is hosted on the cdn.nos.nl content delivery network.
