@media only and screen code example
Example 1: 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 2: css different sreen size
/* For Mobile */
@media screen and (max-width: 540px) {
.view {
width: 400px;
}
}
/* For Tablets */
@media screen and (min-width: 540px) and (max-width: 780px) {
.view {
width: 600px;
}
}