media query for small screen code example
Example 1: media query
@media only screen and (max-width: 600px) {
body {
background-color: lightblue;
}
}
Example 2: css media query
@media (min-width: 576px) {
.selector {
background-color:#f00;
}
}
@media (min-width: 768px) {}
@media (min-width: 992px) {}
@media (min-width: 1200px) {}
Example 3: min and max width media query
@media (max-width: 989px) and (min-width: 768px) {}
Example 4: mobile tablet desktop media queries
Syntax:
@media( media feature ) {
// CSS Property
}
The screen resolutions of different devices are listed below:
Mobile (Smartphone) max-width: 480px
Low Resolution Tablets and ipads max-width: 767px
Tablets Ipads portrait mode max-width:1024px
Desktops max-width:1280px
Huge size (Larger screen) max-width: 1281px and greater
Example 5: media query
@media only screen and (max-width: 600px) {
.class {
// Your CSS
}
}