Check HTML Markup Validity

Technology CommunityCategory: HTML5Check HTML Markup Validity
VietMX Staff asked 3 years ago

Consider the following markup. Is it valid? If not, can you explain why?

<figure>
   <picture>
      <source media="(min-width: 40em)"
      srcset="large.jpg 1024w, medium.jpg 640w, small.jpg 320y">
      <img src="medium.jpg" alt="London by night">
   </picture>
   <figcaption>A landscape of London by night</figcaption>
</figure>

Answer:

The markup uses the relatively new picture element. The code is all valid apart from the last image specified in the srcset attribute. 320y is not a valid value, and the y should be replaced with a w.