老师,帮忙看一下
来源:5-2 编程练习
慕丝5187111
2018-10-22 17:22:38
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
/* 在此处补充代码*/
*{
margin:0;
padding:0;
}
ul{
list-style:none;
}
header{
width:100%;
height:100px;
background:#000;
display:flex;
justify-content: space-around;
}
.nav{
width: 500px;
color:#fff;
display: flex;
justify-content: space-around;
align-items: center;
font-size: 22px;
}
.login{
width: 150px;
display: flex;
justify-content: space-around;
align-items: center;
}
.login input{
background: orange;
width: 50px;
height: 30px;
border-radius: 5px;
outline: none;
border:none;
color: #fff;
font-size: 18px;
}
section{
display: flex;
justify-content: space-around;
flex-wrap: wrap;
}
.section{
margin: 20px 0 0 0;
width: 600px;
height: 150px;
background: #abcdef;
border-radius: 10px;
display: flex;
justify-content: space-around;
align-items: center;
}
.shopping{
width: 100px;
height: 40px;
background: orange;
border-radius: 6px;
font-size: 18px;
color: #fff;
line-height: 40px;
text-align: center;
}
.box{
height: 150px;
display: flex;
flex-direction: column;
justify-content: space-around;
}
</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-10-22
经测试下面内容是一行显示三个:

你设置的.section宽度为600px,自己测试的时候可能是一行显示两个,但是每个显示器的分辨率不同,显示效果也会不同,所以建议设置.section宽度为百分比为45%左右。
自己可以测试一下,祝学习愉快!
相似问题