1. 程式人生 > >html設置多個div並排顯示

html設置多個div並排顯示

ima code info pre image img .com inf 設置

我這裏以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並排顯示