我将“section”元素用作“header”元素中的容器。
容器没有以任何方式显示。
HTML
<!-- start pagewrap -->
<div id="pagewrap">
<!-- start header -->
<header>
<section id="container">
</section>
</header>
<!-- end header -->
</div>
<!-- end pagewrap -->
CSS
header {
position: absolute;
left: 0px;
width: 100%;
height: 65px;
background-color: #F9F9F9;
border-bottom: thin solid #C6D9F1;
margin: 10px 0 10px 0;
}
header section #container {
width: 900px;
height: 30px;
border: thin dotted black;
margin: 0 auto;
}
最佳答案
你有一个小错误:
将 CSS 中的 header section #container
更改为 header section#container
,如下所示:
header section#container {
width: 900px;
height: 30px;
border: thin dotted black;
margin: 0 auto;
}
您所做的基本上是在 id="container"
部分中寻找元素宽度。
关于css - <header> 中的容器元素未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17354334/