media Queries
CSS3 Media Types
| Value | Description |
|---|---|
| all | Used for all media type devices |
| Used for printers | |
| screen | Used for computer screens, tablets, smart-phones etc. |
| speech | Used for screenreaders that "reads" the page out loud |
If the browser window is 600px or smaller, the background color will be lightblue:
@media only screen and (max-width: 600px) {
body {
background-color: lightblue;
}
}
if the viewport is 480 pixels wide or wider
@media screen and (min-width: 480px) {
body {
background-color: lightgreen;
}
}
/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {...}/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {...}
/* Medium devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) {...}
/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {...}
/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {...}
@media only screen and (orientation: landscape) {
body {
background-color: lightblue;
}
}
Comments
Post a Comment