Responsive Web Design Principles Flashcards

1
Q

What does a Media Query do?

A

Changes the presentation of content based on different viewport sizes. The viewport is a user’s visible area of a web page, and is different depending on the device used to access the site. Here’s an example of a media query that returns the content when the device’s width is less than or equal to 100px:

@media (max-width: 100px) { /* CSS Rules */ }

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

We have a paragraph with 20px for font-size. How would we use media queries to make paragraphs 10px font-size at 800px or less?

A

p {
font-size: 20px;
}

@media (max-height: 800px) {
p {font-size: 10px;}
}

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

What two things will make any image responsive?

A

A max-width of 100% and height: auto. The max-width will make sure that it’s not bigger than the container it’s in, and the height: auto will make the image keep its original aspect ratio.

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

What are the four different viewport units?

A

vw (viewport width): 10vw would be 10% of the viewport’s width.
vh (viewport height): 3vh would be 3% of the viewport’s height.
vmin (viewport minimum): 70vmin would be 70% of the viewport’s smaller dimension (height or width).
vmax (viewport maximum): 100vmax would be 100% of the viewport’s bigger dimension (height or width).

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