responsive media queries code example
Example 1: media query min and max
@media only screen and (max-width: 600px) {...}
@media only screen and (min-width: 600px) {...}
@media only screen and (max-width: 600px) and (min-width: 400px) {...}
Example 2: media query for mobile view css
@media only screen and (max-width: 600px) {
body {
background-color: lightblue;
}
}
Example 3: media query breakpoints
// Best Practice suggests
// keep default style for smallest screen size (portrait mobile, below 576px)
// and then proceed in assending order with media query like below
// Small devices (landscape phones, 576px and above till next break point)
@media (min-width: 576px) { ... }
// Medium devices (tablets, 768px and above till next break point)
@media (min-width: 768px) { ... }
// Large devices (desktops, 992px and above till next break point)
@media (min-width: 992px) { ... }
// so on ...
Example 4: css media query responsive sizes
320px
480px
600px
768px
900px
1024px
1200px
Example 5: media query
@media (max-height : 800px){
p{
font-size:10px
}
}