您现在的位置: 万盛学电脑网 >> 程序编程 >> 网页制作 >> DivCSS教程 >> 正文

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

作者:佚名    责任编辑:admin    更新时间:2022-06-22

实现多个div在同一行显示的应用还是比较广泛的,于是做了个示例,初学者可以参考下,希望对大家有所帮助

 

以下为css样式:

复制代码 代码如下:
div{
margin-bottom: 10px;
clear:both;
word-break:break-all;
word-wrap:break-word;
}

 

复制代码 代码如下:


<pre name="code" class="css"><!--width指定每个div占据的宽度--></pre& gt;.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>