DONT ADD ANYTHING HERE!

  1. Best viewed on laptop in Responsive Design Mode
    1. ⌃ ⌘ R on Mac/Safari
    2. ⌥ ⌘ R on Mac/Firefox
  2. Note error when srcset has width descriptor (eg 650w) and source element has media attribute but with no sizes attribute
  3. There seems to be no way of using sizes with srcset from within the source tag

Example (Picture element)

Picture of large kitten

Example (img tag)

Large picture of kitten

HTML (Picture)


<picture>
    <source 
        srcset="../images/kitten-large-650.png" 
        media="(min-width:850px)">

    <source 
        srcset="../images/kitten-medium-465.png" 
        media="(min-width:600px)">

    <source 
        srcset="../images/kitten-small-330.png" 
        media="(min-width:330px)">

    <img 
        src="../images/kitten-large-marked-650.png" 
        alt="Picture of large kitten">
</picture>

HTML (img)


<img 

    id="thecat" 

    srcset="../images/kitten-large-650.png 650w,
            ../images/kitten-medium-465.png 465w,
            ../images/kitten-small-330.png 330w" 
    
    sizes="(min-width:850px) 650px, 
           (min-width:600px) 465px, 
           330px"

    src="./images/kitten-large-650.png" 

    alt="Large picture of kitten">

CSS (both)


img {
    border: 2px solid green;
    width: 100%;
} 

Nu Html Checker

Specifying a srcset width descriptor (650w) without a sizes attribute produces a validation error
Error: When the srcset attribute has any image candidate string with a width descriptor, the sizes attribute must also be specified
From line 98, column 29; to line 98, column 107 <source srcset="../images/kitten-large-650.png 650w" media="(min-width:850px)">