我这里以4个div为例,html代码如下:
<body> ???<div id="column1" style="background-color: blue;float:left;width:25%">a</div> ???<div id="column2" style="background-color :cyan;float:left;width:25%">b</div> ???<div id="column3" style="background-color: yellow;float:left;width:25%">c</div> ???<div id="column4" style="background-color: red;float:left;width:25%">d</div></body>
这里主要是这个float:left
。
效果如下:
html设置多个div并排显示
原文地址:https://www.cnblogs.com/zifeiy/p/9876627.html