我有两个容器。一个完整内容(容器1),然后在右侧,我有一个包含用户信息(容器2)的框:如何控制容器高度?
当我向容器中添加内容时,如果内容长度超过高度,内容会持续超出容器。所以我决定增加高度:auto;但是,这会弄乱Container2的表现。有什么我可以做,以确保他们保持一致?
代码
<div id="container">
<h1>$nameis</h1>
Here will be the content that will be longer and shorter on certain pages.
</div>
<div id="container2">
<div id="welcoming">
<input id="search">
<h3><?php echo $angelinajolie;?></h3>
<h3><a href="/lastlogin.php">Logins</a></h3>
<h3><a href="/stats.php">Stats</a></h3>
</div>
</div>
CSS
div#container {
background-color: #FFFFFF;
margin:0 auto;
height: 300px;
width:60%;
font-family: "Lucida Grande", Verdana, "Lucida Sans Unicode", Arial, Helvetica, sans-serif;
border:0px solid #FFFFFF;
margin-top:25px;
font-size:15px;
color: #222222;
margin-left:60px;
}
#container2 {
margin:0 auto;
height: 80px;
width:20%;
font-family: "Lucida Grande", Verdana, "Lucida Sans Unicode", Arial, Helvetica, sans-serif;
border:0px solid #FFFFFF;
margin-top:25px;
font-size:15px;
color: #E1E1E1;
margin-left: 70%;
margin-top:-317px;
}
好的。我需要第二种选择,但问题是内容被吃掉了。我不想使用滚动条。我正在显示搜索结果,因此只显示符合200px的高度的结果... – AAA 2011-01-23 16:39:44