关于width:100%
2条评论»<!--css-->
#layout{
position:absolute;
min-width:400px;
_width:400px;
min-height:300px;
_height:300px;
border:1px solid #F00;
background:#EEE;}
#title,#content{
white-space:nowrap;
background:#CCC;
border-bottom:2px solid #000;
font-weight:bold;
}
#content{
border:none;
padding:10px 0;
background:#FFF;
font-size:12px;
font-weight:normal;
}
<!--css-->
<!--xhtml-->
<div id="layout">
<h2 id="title">如何用 Javascript</h2>
<p id="content">坦白说,起先我对短短的五行代码</p>
</div>
<!--xhtml-->
测试无忧上一个问题引出的另外一个问题。由于设置了min-width和width,white-space在FF和IE中都会因为内容过多将#layout宽度撑开。按道理#title和#content的宽度都会自动伸展到与#layout一致,但是IE6中并不会自动伸展到和#layout一致的宽度~···只保持在最初#layout宽400px时100%的宽度~···
同时发现,当为#title,#content设置width:100%的时候,IE7也会出现和IE6同样的问题,个人觉得可能是hasLayout引发的~···
这个问题现在人没找到合理的解决办法,记下~···
评论(2)
你设定了: _width,和_height,对ie6起作用了,当然不会撑开!
@小田 是这样吗?IE6中即使设置了width,height,其布局也是可以被撑开的~