I noticed that setting the html and body height to 100%, the body's width seems to be set automatically to 100% (even if it does not appear among the css rules), why?
<html>
<head
<title>full screen</title>
<style>
html, body{
margin: 0;
height: 100%;
background-color: rgb(200,50,50);
}
</style>
</head>
<body>
</body>
</html>
Setting these elements' heights to any value (or even not setting it at all) doesn't change their width, which is 100% by default due to them being block
elements.
You can verify this by inspecting any HTML page in your browser and looking for the property display: block;
, defined by user agent stylesheet
(your browser), in these elements.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.