代码这样写,符合5-2的要求吗
来源:6-1 课程总结
saki_bcc
2018-01-10 19:28:08
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
/* 在此处补充代码*/
/*头部 */
*{
padding: 0;
margin: 0;
}
header {
display: flex;
justify-content: space-around;
align-items: center;
background-color: #000;
width: 100%;
}
.nav {
display: flex;
justify-content: space-around;
align-items: center;
width: 600px;
list-style: none;
font-size: 20px;
color: #fff;
}
.login {
display: flex;
width: 130px;
justify-content:space-between;
}
.login input {
width: 45px;
height: 30px;
border: 1px solid rgb(255,164,34);
background: rgb(255,164,34);
border-radius: 5px;
font-style: 25px;
font-weight: bold;
color: #fff;
}
/*购物卡*/
section {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}
.section {
display: flex;
justify-content: space-between;
margin-top:20px;
padding: 0 50px 0 50px;
background-color: rgb(105,236,245);
border: 1px solid transparent;
border-radius: 9px;
box-sizing: border-box;
width: 860px;
height: 200px;
}
.box {
display: flex;
flex-direction: column;
justify-content: space-around;
font-size: 24px;
}
.shopping {
display: flex;
justify-content: center;
align-self: center;
width: 150px;
height: 60px;
border: 1px solid transparent;
background: rgb(255,164,34);
border-radius: 8px;
line-height: 60px;
color: #fff;
font-size: 24px;
font-weight: bold;
}
</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网页开发到移动端相应开发》</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网页开发到移动端相应开发》</p>
<div>适用人群:有html和css基础的童鞋</div>
<div>费用:¥599</div>
</div>
<div class="shopping">
<div class="btn">加入购物车</div>
</div>
</div>
</section>
</body>
</html>1回答
小于飞飞
2018-01-11
调整如下;
因为分辨率的大小不同,所以div宽度不要设置固定的,同时要求一行显示两个所以,div宽设置如45%,这样保持2个一行。
同时因为分辨率的大小不同,所以当分辨率小时,布局发生异常,所以不body设置min-width,如:min-width:1300px
希望对你有帮助,动手实践,加油!
相似问题