@media screen css code example
Example 1: css media queries
@media only screen and (max-width: 1200px){
/*Tablets [601px -> 1200px]*/
}
@media only screen and (max-width: 600px){
/*Big smartphones [426px -> 600px]*/
}
@media only screen and (max-width: 425px){
/*Small smartphones [325px -> 425px]*/
}
Example 2: css media query
/* BOOSTRAP MEDIA BREAKPOINTS */
/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
.selector {
background-color:#f00;
}
}
/* Medium devices (tablets, 768px and up) The navbar toggle appears at this breakpoint */
@media (min-width: 768px) {
}
/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
}
/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
}
Example 3: media queries les plus utilisees
/* Sur les écrans, quand la largeur de la fenêtre fait au maximum 1280px */
@media screen and (max-width: 1280px)
/* Sur tous types d'écran, quand la largeur de la fenêtre est comprise entre 1024px et 1280px */
@media all and (min-width: 1024px) and (max-width: 1280px)
/* Sur les téléviseurs */
@media tv
/* Sur tous types d'écrans orientés verticalement */
@media all and (orientation: portrait)
Example 4: css media screen
@media (max-width: 991px){
.mobile{
display: block;
}
}
Example 5: css @media
/* When the width is between 600px and 900px OR above 1100px */
@media screen and (min-width: 600px) and (max-width: 900px), (min-width: 1100px) {
div.example {...}
}
Example 6: media query
@media only screen and (max-width: 600px) {
.class {
// Your CSS
}
}