国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > CSS > 正文

CSS多列布局實現方法大全

2024-07-11 09:00:43
字體:
來源:轉載
供稿:網友

 摘要:

多列布局在網站應用中也是經常見到的,今天就分享4中多列布局。

display:table


代碼如下:

<style>
.table {
width: auto;
min-width: 1000px;
margin: 0 auto;
padding: 0;
display:table;
}
.tableRow {
display: table-row;
}
.tableCell {
border: 1px solid red;
display: table-cell;
width: 33%;
}
</style>
<div class="table" >
<div class="tableRow" >
<div class="tableCell" >
one
</div>
<div class="tableCell" >
two
</div>
<div class="tableCell" >
three
</div>
</div>
</div>

float

 

代碼如下:

<style>
.row {
float: left;
width: 33%;
border: 1px solid red;
}
</style>
<div class="row" >
one
</div>
<div class="row" >
two
</div>
<div class="row" >
three
</div>

display: inline-block

代碼如下:

<style>
.row {
display: inline-block;
width: 32%;
border: 1px solid red;
}
</style>
<div class="row" >
one
</div>
<div class="row" >
two
</div>
<div class="row" >
three
</div>

column-count

代碼如下:

<style>
.column {
/* 設置列數 */
-moz-column-count:3; /* Firefox */
-webkit-column-count:3; /* Safari and Chrome */
column-count:3;
/* 設置列之間的間距 */
-moz-column-gap:40px; /* Firefox */
-webkit-column-gap:40px; /* Safari and Chrome */
column-gap:40px;
/* 設置列之間的規則 */
-moz-column-rule:4px outset #ff0000; /* Firefox */
-webkit-column-rule:4px outset #ff0000; /* Safari and Chrome */
column-rule:4px outset #ff0000;
}
</style>
<div class="column"></div>

小結:

以上代碼都是在chrome上測試,如果使用請注意兼容性,有任何問題都可以提問

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 开鲁县| 丹棱县| 郧西县| 霍州市| 和硕县| 武义县| 沽源县| 冕宁县| 金塔县| 繁昌县| 昆明市| 象州县| 华容县| 内黄县| 大庆市| 苏州市| 芜湖县| 石河子市| 浮山县| 潼南县| 六盘水市| 景泰县| 白河县| 团风县| 承德市| 垦利县| 平定县| 邵阳市| 桐梓县| 城市| 侯马市| 吉隆县| 陇川县| 浪卡子县| 贵州省| 浮山县| 新蔡县| 武山县| 西吉县| 馆陶县| 姜堰市|