CSS 实际应用-无高度时,宽度也就无效
ITPOW2017/2/22 18:20:45
<div style="float:left; width:10%; background:#f00;"></div> <div style="float:left; width:80%; background:#0f0;">222</div> <div style="float:left; width:10%; background:#00f;">333</div>
如上代码,第一个 div 没有高度,宽度也就无效,最终的显示效果就是
等同于没有这个 div
。
如何才能使它有高度呢?
法一是指定 height CSS 属性。
法二是指定内容。不过空格、换行符、Tab 这种空白字符是无效的,实在没有内容可写,就写 吧。
<<返回首页<<