The RICG is a group of independent designers and developers working toward new web standards that will build fast, accessible, responsive websites.
Media queries allow authors to vary the layout of their page based on the dimensions of the viewport. Container queries will allow developers to vary the layout within specific elements on a page (and their children) based on the dimensions of the parent elements themselves, allowing for much more modular approaches to layout.
Work on container queries has just begun; we are still collecting use cases and working to understand technical constraints. Please contribute!
picture element contains any number of child
source elements and one
When this pattern is used with the
media attribute on
source elements, it allows developers to mandate that user agents must load specific sources when certain media conditions are met. This allows developers to specify alternate aspect ratios to align with layoutchanges, or alternate framing of image content for optimally highlighting the subject of the image at different sizes.
source are used with the
type attribute, authors may supply the same image in alternate formats to be requested only by browsers that support said format.
<picture> <source srcset="large.jpg" media="(min-width: 800px)"> <img src="small.jpg" alt="…"> <picture>
w descriptor and the
sizes attribute allow developers to supply a range of alternate sources for images whose sizes vary within a responsive layout. Optionally working in conjunction with server-side resizing, these syntaxes allow for a fully automated “responsive images” solution.
<img src="small.jpg" sizes="100vw" srcset="med.jpg 800w, large.jpg 1400w" alt="…">
srcset attribute allows developers to supply user agents with alternate versions of an image, intended for display at different pixel densities.
In its most basic and well-supported form, srcset lets developers use
x descriptors to specify the intended pixel-density of each source.
<img src="standard-definition.jpg" srcset="high-definition.jpg 2x">