Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Media queries (responsive design) worksheet is part of the HTML and CSS Journey journey. Print it as a booklet?
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1@media (max-width: 600px) { .box { display: none; } } | A@media screen and (max-width: 480px) { img { width: 100%; } } | |
| 2@media (min-width: 1024px) { body { font-size: 18px; } } | B@media (orientation: landscape) { .nav { height: 50px; } } | |
| 3A responsive design rule that applies specific styles when a device is held horizontally. | CFails because it is missing the mandatory @ character at the very beginning of the rule. | |
| 4Combines screen type and a maximum width condition to style mobile devices. | DFails because media feature expressions like max-width must be enclosed in parentheses. | |
| 5@media max-width: 768px { p { color: blue; } } | EHides elements with the box class on screens that are 600 pixels wide or smaller. | |
| 6media (min-width: 480px) { h1 { font-size: 2rem; } } | FIncreases body text font size for desktop screens 1024 pixels wide or larger. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
@media — A CSS rule used to apply different styles for different media types or screen sizes.@media (max-width: 600px) {
body { color: red; }
}@media (min-width: 768px) {
.nav { display: block; }
}@media (max-width: 480px) {
.sidebar { display: none; }
}@media screen and (max-width: 900px) {
.card { width: 50%; }
}@media (orientation: landscape) {
.hero { height: 100vh; }
}