Div+CSS教程

关注公众号 jb51net

关闭
网页制作 > CSS > Div+CSS教程 >

让多个div在同一行显示的样式及html代码

脚本之家

以下为css样式:


div{
margin-bottom: 10px;
clear:both;
word-break:break-all;
word-wrap:break-word;
}



<pre name="code" class="css"><!--width指定每个div占据的宽度--></pre>.custom_div{height: 23px;width: 50px;line-height: 23px;float: left;}
<pre></pre>

以下为html代码:
[code]
<pre name="code" class="html">
<div id="pid">
<div id="d1" class="custom_div">jelly1</div>
<div id="d2" class="custom_div">jelly2</div>
<div id="d3" class="custom_div">jelly3</div>
</div></pre>