html device width code example
Example 1: viewport meta tag
<meta name="viewport" content="width=device-width, initial-scale=1">
Example 2: device-width
body {
background: white;
}
@media screen and (min-width: 980px) /* Desktop */ {
body {
background: red;
}
}
@media screen and (max-width: 979px) /* Tablet */ {
body {
background: blue;
}
}
@media screen and (max-width: 500px) /* Mobile */ {
body {
background: green;
}
}
Example 3: viewport
// viewport for Responsive Design
<meta name="viewport" content="width=device-width, initial-scale=1.0">