我的标题没有出现在任何地方。我想知道如何解决它。
body {
background-color: antiquewhite;
font-size: 100%;
width: 100%;
height: auto;
}
nav {
height: 8%;
width: 100%;
position: fixed;
display: block;
background-color: grey;
z-index: 1000;
}
header {
width: 100%;
background-image: url("https://placehold.it/50/50");
}
<nav>
<h1>...</h1>
</nav>
<header>
</header>
最佳答案
这样就可以了:
html, body {height:100%;}
如果您使用百分比作为高度,父项需要有一个固定的高度(所以实际上它是某物的 8%)或者至少所有父项直到 html
标签需要有一个百分比高度。
关于html - 百分比调整 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41167827/