您的位置:首页 > Web前端 > HTML5

HTML5基础加强css样式篇(table-cell应用,多列等宽)(五十)

2017-04-21 14:26 501 查看
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">

/*
制作多列等宽自适应布局

1.父元素  display:  table; width: 100%
2.布局元素(子元素 ) display: table-cell;
3.子元素之间的空隙,通过一个正常的div分割即可。
4.如果存在多行,需要在包裹一个 display: table-row(<tr>)
*/

.table-box{
display: table;
width: 100%;
}
.box {
height: 200px;
width: 33.3333333%;
display: table-cell;
}
.box1{
background-color: red;
}
.box2{
background-color: blue;
}
.box3{
background-color: gold;
}

.white-space{
height: 200px;
width: 5px;
background-color: #fff;
}

/*display: table-cell == <td>*/

</style>
</head>
<body>
<div class="table-box">
<div class="box box1"></div>
<div class="white-space"></div>
<div class="box box2"></div>
<div class="white-space"></div>
<div class="box box3"></div>
</div>

<script type="text/javascript">
</script>
</body>
</html>

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  css html5 经验 css3 html
相关文章推荐