为什么BODY标签不覆盖HTML标签属性?
我已将此 css 应用于我的 html 文档:
html {
background-color: red;
}
body {
background-color: yellow;
}
html {
background-color: red;
}
body {
background-color: yellow;
}
回答
因为你的身体是空的(0px高度)
如果我们改变身体的 h/w,你会得到这个(包括你可以重置的边距/填充)
html {
background-color: red;
}
body {
background-color: yellow;
width: 100vw;
height: 100vh;
}
内容:
<h1>Body no longer empty</h1>