Responsive Fundamentals: HTML, Images, CSS Flashcards

1
Q

What attributes can an image tag have for responsive images, and how does it handle a fallback or default image?

A

srcset and sizes; fallback is src. srcset=”a list of images and their sizes” sizes=”optional rules”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is syntax for srcset attribute?

A

srcset = “small.jpg 300vw, medium.jpg 640vw, large.jpg 1200w” // numbers are the natural image width in pixels but should be w.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does this mean? sizes=”(max-width: 640px) 100vw, 25vw”

A

If viewport is under 640px, display image at 100%; otherwise display at 25%.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What’s the syntax for a media query for screen, a minimum width, and seen in landscape mode?

A

@media screen and (min-width: 720px) and (orientation: landscape) { …

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What meta attribute should you use to ensure appropriate zooming for responsive websites?

A

meta name=”viewport” content=”width=device-width, initial-scale=1”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what is syntax for sizes attribute?

A

sizes = “(min/max width: n pixels) width of image relative to viewport width, default width if rules don’t apply”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly