css device width code example
Example 1: media query
@media only screen and (max-width: 600px) {
body {
background-color: lightblue;
}
}
Example 2: css different sreen size
@media screen and (max-width: 540px) {
.view {
width: 400px;
}
}
@media screen and (min-width: 540px) and (max-width: 780px) {
.view {
width: 600px;
}
}
Example 3: device-width
body {
background: white;
}
@media screen and (min-width: 980px) {
body {
background: red;
}
}
@media screen and (max-width: 979px) {
body {
background: blue;
}
}
@media screen and (max-width: 500px) {
body {
background: green;
}
}