Put an img inside a picture element.
Acceptance criteria
- 1.Put an img inside a picture element.
HTML Tutorial · HTML Tags
These 10 tasks go with the HTML <picture> Tag chapter. 5 of them ask you to build something small from scratch; 5 give you code that is already broken and ask you to work out why. Set aside about 90 minutes for the whole set, though you can do them in any order.
Nothing here is marked by a person. When you press Submit, the editor checks your code against the points listed under each task and tells you straight away what passed and what didn't (you need a free account to submit). If you get stuck, there are hints, and a worked solution once you've had a go. The first 2 tasks are free; the rest are part of the practice plan.
If it's been a while since you read the chapter, here is how it starts: “The tag in HTML is used to provide multiple image sources for responsive designs. It allows the browser to choose the most suitable image based on screen size, resolution, or format support . It’s commonly used with and tags inside it.” .
1.Wrap an imageexercise · easy · 10 min
Put an img inside a picture element.
Passes when: Put an img inside a picture element.
2.Offer a wide versionexercise · easy · 10 min · practice plan
Add a source used on wide screens.
Passes when: Add a source used on wide screens.
3.Offer a modern formatexercise · easy · 10 min · practice plan
Add a source with a type so newer browsers use it.
Passes when: Add a source with a type so newer browsers use it.
4.Two sourcesexercise · easy · 10 min · practice plan
Provide two sources before the fallback image.
Passes when: Provide two sources before the fallback image.
5.A complete responsive pictureexercise · medium · 10 min · practice plan
Two sources and a described fallback image.
Passes when: Two sources and a described fallback image.
6.Fix the picture with no imagebug fix · easy · 8 min
A picture must end with an img fallback.
Passes when: A picture must end with an img fallback.
7.Fix the media query in the wrong attributebug fix · easy · 8 min · practice plan
Screen conditions go in media.
Passes when: Screen conditions go in media.
8.Fix the format hint missingbug fix · easy · 8 min · practice plan
A format-based source needs its type.
Passes when: A format-based source needs its type.
9.Fix the missing second sourcebug fix · easy · 8 min · practice plan
Only one screen size was catered for.
Passes when: Only one screen size was catered for.
10.Fix the fallback with no alt textbug fix · easy · 8 min · practice plan
The img inside a picture still needs alt text.
Passes when: The img inside a picture still needs alt text.
Between them these tasks cover Art direction, srcset and Responsive images.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.