html, .large { font-size: 36px;
color: #ffffff;
background-color: #000000;
}
/* This does not work @media(max-width: 600px) { html { background-color: lightblue; } */
@media(max-width: 600px) {
body { background-color: lightblue; }
}
blockquote, button, select, .bq, .required {
background-color: #0d0d0d;
color: #ffffff;
font-size: 0.8rem;
}
ul { text-align: left }
ul li { display: inline;
font-size: 62.5%;
margin: 50px;
padding: 0px;
}
<!DOCTYPE html>
<html class="large">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="stylesheet" href="myBlogDM.css"/>
<style>
</style>
</head>
<body>
<ul>
<li><a href="https://english-writing.github.io">Home</a></li>
<li><a href="samples.html">Sample CVs</a></li>
<li><a href="blog/1.html">Blog</a></li>
<li><a target="_blank" href="http://twitter.com/">Twitter</a></li>
<li><a href="faq.html" >Frequently Asked Questions</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
<h1>Jim Smith</h1>
<hr>
<h3>Writer</h3>
<p>I write CVs and letters in English in html and pdf.
I am an experienced writer ...
</p>
</body>
</html>
As the comment points out, when I use @media(max-width: 600px) html { background-color: lightblue; } }
it does not change the background colour in response to the resizing of the browser window or
the opening of the file on a mobile device. Yet, when I change the selector to body
than it works as intended.
When I my stylesheet to html { font-size: 36px;
color: #ffffff;
background-color: #000000;
}
then it works, why?
If the background colour of my document was set with html
selector
in the first place, why doesn't it change with
@media(max-width: 600px) html { background-color: lightblue; } }
?