Changing background color on resize using @media
changing background color using the @media in css viewport. using the meta tag
HTML
<html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<body>
<h1>
Check the color changes on resizing window.
</h1>
</body>
</html>
CSS
body{
background-color: tomato;
color:white;
}
@media all and (max-width: 700px){
body{
background-color: yellow;
color:black;
}
}