如果想实现Flex布局一行三个平均分布。我们需要使用到下面命令。
通过使用下述命令,我们轻松实现flex的子元素自动3等分距离。
display: flex;
justify-content: space-between;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>全栈攻城狮:沧桑站长带你学知识!
http://www.quanzhangongchengshi.com/
</title>
<style type="text/css">
.container{
width: 400px;
height: 400px;
border: 1px solid;
display: flex;
justify-content: space-between;
}
.box1,.box2,.box3{
width: 100px;
height: 100px;
}
.box1{
background-color: antiquewhite;
}
.box2{
background-color: #f00;
}
.box3{
background-color: #000;
}
</style>
</head>
<body>
<div class="container">
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
</div>
</body>
</html>

发表评论 取消回复