Media Queries Flashcards
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.
@media screen and (max-width: 768px) { body { background: #FF6347; color: #FFF; } }
Create a new media query that sets the body element’s background color to #4682B4 if the viewport width is 480px or less.
@media screen and (max-width: 480px) { body { background: #4682B4; } }
Create a new media query that sets the width of .wrap to 700px if the viewport is 800px or wider.
@media screen and (min-width: 800px) { .wrap { width: 700px; } }
Create a media query that floats the .col elements left if the viewport is 481px or wider.
@media screen and (min-width: 481px) { .col { float: left; } }
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.
@media screen and (min-width: 769px) { .logo { float: left; } .main-nav { float: right; } .extra { display: block; } }
Create a new media query that sets the width of .wrap to 980px if the viewport is 1000px or wider.
@media screen and (min-width: 1000px) { .wrap { width: 980px; } }
Y/N: Does the ‘orientation’ media feature only work on mobile devices?
No, it affects all devices including desktop browsers.
How do we determine the ‘resolution’ value in dpi or ppi?
Multiply the device-pixel-ratio by 96
What media feature checks for the full screen width of a device?
device-width
What meta tag instructs a device to zoom its layout viewport to 100% the device width?
(meta name=”viewport” content=”width=device-width”)
If a device has a pixel-ratio of 2, then 1 CSS pixel is displayed as _____ physical pixel(s) on screen.
2
A device-pixel-ratio of 2 is equivalent to a resolution value of _____ dpi.
192
A device-pixel-ratio of 1 is equivalent to a resolution value of _____ dpi.
96
Commas “,” between media query lists behave like what?
The “or” operator
What media type do we need to use for paged media?
@media print