Responsive web design makes your page look good on desktops, tablets, and mobile phones using only HTML and CSS.
Use this in the <head> of your HTML:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Example: media="screen,print"
The background changes based on screen width or orientation:
body { background-color: blue; }
@media screen and (min-width: 480px) {
body { background-color: green; }
}
@media only screen and (orientation: landscape) {
body { background-color: grey; }
}
Example of a responsive 12-column grid layout:
Mobile-first: Start with small screens, then add styles for larger devices using min-width.
Desktop-first: Start with large screens, then adjust for smaller devices using max-width.