我很难理解 div。
我想让“导航”面板根据需要垂直展开。我遇到的第二个问题是我似乎无法让填充工作。我所做的任何更改往往会导致“section”div 低于“nav”div。
请参阅下面的 jsfiddle 和代码。
提前致谢。
https://jsfiddle.net/s59cwy9s/
<div id="container">
<div id="nav">
test
</div>
<div id="section">
test
<br><br><br><br>
test
<br><br><br><br>
test
</div>
</div>
#container
{
width: 1156px;
margin-top: 0;
margin-left: auto;
margin-right: auto;
box-shadow: 5px 5px 10px rgb(0,0,0);
position: relative;
background-color: transparent;
height: auto;
}
#header
{
background-color:black;
color:white;
text-align: center;
padding:5px;
}
#nav
{
line-height:30px;
background-color:#eeeeee;
min-height: 100px;
min-width: 80px;
float:left;
padding: 15px;
display: inline-block;
height: auto;
}
#section
{
/*float: none;*/
padding: 10px;
display: block;
/*position: absolute;*/
/*overflow: auto;*/
background-color: white;
width: auto;
height: auto;
}
最佳答案
这可能是因为您的名称栏没有完全跨越网页的高度。为导航栏尝试 height :100% 之类的东西。它可能会成功。
关于html - 了解 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32800686/