前端学习(530):等分布局得间距方案第二种方式
作者:互联网
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>等分布局</title>
<style>
.parent{
width: 100%;
display: table;
margin-left: -10px;
}
.col1,.col2,.col3,.col4{
height: 300px;
display: table-cell;
padding-left: 10px;
box-sizing: border-box;
}
.col1 .inner{
background-color: black;
}
.col2 .inner{
background-color: lightblue;
}
.col3 .inner{
background-color: red;
}
.col4 .inner{
background-color:yellow;
}
.inner{
height: 300px;
}
</style>
</head>
<body>
<div class="fix">
<div class="parent">
<div class="col1">
<div class="inner"></div>
</div>
<div class="col2">
<div class="inner"></div>
</div>
<div class="col3">
<div class="inner"></div>
</div>
<div class="col4">
<div class="inner"></div>
</div>
</div>
<div class="inner"></div>
</div>
</body>
</html>
运行结果
标签:间距,第二种,color,col4,height,inner,background,530,table 来源: https://blog.csdn.net/weixin_43392489/article/details/104839760