怎么设置一行只显示两个块呢,我设置了4个它会在一行显示
来源:5-2 编程练习
qq_天_30
2018-03-21 11:27:43
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
/* 在此处补充代码*/
* {
margin: 0;
padding: 0;
}
header {
display:flex;
background:black;
width:100%;
align-items:center;
justify-content:space-around;
}
header .nav {
width:300px;
display:flex;
justify-content: space-around;
}
header .nav li {
color:white;
list-style: none;
}
header .login {
display: flex;
}
header .login input {
margin-right:5px;
}
section {
display:flex;
justify-content: space-around;
width:100%;
}
section .section {
width:40%;
height:120px;
margin-top:10px;
border-radius:4px;
background: #abcdef;
display:flex;
align-items: center;
justify-content: space-around;
}
section .section .box {
height:100%;
display: flex;
flex-direction:column;
justify-content: space-around;
}
section .shopping .btn {
width:100px;
height:40px;
background: orange;
border-radius:4px;
color:white;
text-align: center;
line-height: 40px;
}
</style>
</head>
<body>
<!-- 头部 -->
<header>
<div class="logo">
<img src="http://climg.mukewang.com/59197ab000014f1503000100.jpg" alt="">
</div>
<ul class="nav">
<li>课程</li>
<li>路径</li>
<li>猿问</li>
<li>手记</li>
</ul>
<div class="login">
<input type="button" value="登录">
<input type="button" value="注册">
</div>
</header>
<!-- 主体内容 -->
<section>
<div class="section">
<div class="box">
<p>《前端小白入门手册》</p>
<div>适用人群:没有任何前端基础的小白</div>
<div>费用:¥499</div>
</div>
<div class="shopping">
<div class="btn">加入购物车</div>
</div>
</div>
<div class="section">
<div class="box">
<p>《HTML5月CSS3实现动态网页》</p>
<div>适用人群:有html和css基础的童鞋</div>
<div>费用:¥599</div>
</div>
<div class="shopping">
<div class="btn">加入购物车</div>
</div>
</div>
<div class="section">
<div class="box">
<p>《HTML5月CSS3实现动态网页》</p>
<div>适用人群:有html和css基础的童鞋</div>
<div>费用:¥599</div>
</div>
<div class="shopping">
<div class="btn">加入购物车</div>
</div>
</div>
<div class="section">
<div class="box">
<p>《HTML5月CSS3实现动态网页》</p>
<div>适用人群:有html和css基础的童鞋</div>
<div>费用:¥599</div>
</div>
<div class="shopping">
<div class="btn">加入购物车</div>
</div>
</div>
</section>
</body>
</html>1回答
怎么都被占用了呢
2018-03-21
换行就行了

相似问题