Media Queries Flashcards

1
Q

Create a media query that sets the body element’s background color to #FF6347 and its text color to white if the viewport width is 768px or less.

A
@media screen and (max-width: 768px) {
  body {
    background: #FF6347;
    color: #FFF;
  }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Create a new media query that sets the body element’s background color to #4682B4 if the viewport width is 480px or less.

A
@media screen and (max-width: 480px) {
  body {
    background: #4682B4;
  }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Create a new media query that sets the width of .wrap to 700px if the viewport is 800px or wider.

A
@media screen and (min-width: 800px) {
  .wrap {
    width: 700px;
  }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Create a media query that floats the .col elements left if the viewport is 481px or wider.

A
@media screen and (min-width: 481px) {
  .col {
    float: left;
  }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Create a new media query that floats .logo left and .main-nav right if the viewport is 769px or wider and a new property inside the .extra rule that displays it as a block element.

A
@media screen and (min-width: 769px) {
  .logo {
    float: left;
  }
  .main-nav {
    float: right;
  }
  .extra {
    display: block;
  }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Create a new media query that sets the width of .wrap to 980px if the viewport is 1000px or wider.

A
@media screen and (min-width: 1000px) {
 .wrap {
   width: 980px;
 }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Y/N: Does the ‘orientation’ media feature only work on mobile devices?

A

No, it affects all devices including desktop browsers.

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

How do we determine the ‘resolution’ value in dpi or ppi?

A

Multiply the device-pixel-ratio by 96

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

What media feature checks for the full screen width of a device?

A

device-width

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

What meta tag instructs a device to zoom its layout viewport to 100% the device width?

A

(meta name=”viewport” content=”width=device-width”)

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

If a device has a pixel-ratio of 2, then 1 CSS pixel is displayed as _____ physical pixel(s) on screen.

A

2

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

A device-pixel-ratio of 2 is equivalent to a resolution value of _____ dpi.

A

192

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

A device-pixel-ratio of 1 is equivalent to a resolution value of _____ dpi.

A

96

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

Commas “,” between media query lists behave like what?

A

The “or” operator

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

What media type do we need to use for paged media?

A

@media print

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

To set margins around a printed page, we’ll need to use the _____ at-rule.

A

@page

17
Q

What pseudo-class will add the styles defined only to the first printed page?

A

@page:first

18
Q

At the very least, we should set all ‘background’ values to _____, and ‘color’ values to _____.

A

transparent, black

19
Q

What elements are usually not suitable for print?

A

site navigation, comments section, search, and “signup” form fields

20
Q

How do we make a link printer friendly?

A

display the full URL of the link next to the link text