老师,我的作业是本节的3-17编程练习。
来源:3-17 编程练习
慕斯0469344
2019-09-11 16:59:07
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
/* 在此处补充代码*/
header{
background-color: #000;
display: flex;
justify-content: space-around;
align-items: center;
height: 100%;
}
.nav{
width: 30%;
list-style: none;
color:#fff;
display: flex;
justify-content: space-around;
align-items: center;
}
.nav li{
font-size: 16px;
}
.login input{
color:#fff;
font-size: 18px;
background-color: orange;
margin-left: 20px;
}
.login input:hover{
color:#000;
}
section{
display: flex;
justify-content: space-around;
align-items: center;
flex:1;
height: 150px;
margin-top: 20px;
}
.section{
background-color: lightblue;
display: flex;
justify-content: space-around;
align-items: center;
width:45%;
height: 100%;
}
.box{
display: flex;
flex-direction: column;
justify-content:space-around;
align-content: center;
}
.shopping{
background-color: orange;
color: #fff;
font-size: 18px;
font-family: '微软雅黑';
border-radius: 3px;
width:100px;
height: 30px;
display: flex;
justify-content: center;
align-items: center;
}
</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>
</section>
</body>
</html>老师,我觉得完成的不是太好,请您批阅!
1回答
同学你好,1、要有两行显示哦,可以在添加两个块,会发现并没有两行显示。
建议:可以给父级添加flex-wrap: wrap;属性,设置可以换行。例:

2、设置之后发现上下两个之间是紧挨着的,可以设置下上外边距,同时可以设置下圆角。例:

3、建议:导航处的按钮,可以设置下去除边框,即:border:none;同时也可以添加下圆角。

4、建议:可以使用通配符去除下元素的内外边距。

希望能帮助到你,祝学习愉快!
相似问题