<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>
<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">
img {
border: 2px solid green;
width: 100%;
}
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)">