Images
Responsive Images
- Set image widths with percentages to allow them to resize with their parent elements
- Do NOT set heights on images because this will ruin their aspect ratio
Picture Element
picture
elements allow us to set different image sources based on device properties picture
elements use an img
element as a fallback. - MDN picture element ref
- The
img
element will be used as the container to render the picture. - Multiple
source
elements are used to load different versions of the picture. - Each
source
element gets a media attribute which defines the parameters for loading the image.