media Queries

CSS3 Media Types

ValueDescription
allUsed for all media type devices
printUsed for printers
screenUsed for computer screens, tablets, smart-phones etc.
speechUsed 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;
  
}
}
Try it Yourself »

/* 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

Popular posts from this blog

interview questions js[ Anurag Singh ProCodrr]

reactnative_creation