老师,哪里需要改善
来源:3-17 编程练习
前端小白zm
2020-08-17 11:21:52
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
/* 在此处补充代码*/
*{
margin: 0;
padding: 0;
}
/* 头部 */
header{
display: flex;
background: #000;
justify-content: space-around;
}
.nav{
color: #fff;
display: flex;
width: 300px;
justify-content: space-between;
align-items: center;
}
.nav li{
list-style: none;
}
.login{
display: flex;
justify-content: space-between;
align-items: center;
width:110px
}
.login input{
background: orange;
width:40px;
border: none;
color: #fff;
border-radius: 2px;
font-size: 15px;
}
/* 主体内容 */
section{
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
align-content: space-around;
padding-bottom: 10%;
}
.section{
display: flex;
background: rgb(118, 192, 226);
width: 500px;
margin: 20px;
height: 200px;
border-radius: 10px;
}
.box{
display: flex;
flex-direction: column;
justify-content: space-around;
text-indent: 2em;
}
.shopping{
display: flex;
justify-content: center;
align-items: center;
flex-grow: 1;
}
.shopping .btn{
background: orange;
border-radius: 5px;
color: #fff;
font-size: 15px;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
width: 120px;
height: 30px;
}
</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>《前端小白入门手册》</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回答
好帮手慕言
2020-08-17
同学你好,代码中有几个问题需要注意
1、使用同学的代码测试,效果如下:

因为同学设置宽度使用的是px,老师电脑的分辨率较大,所以会出现上方的情况,建议使用百分比设置宽度更好,参考如下修改

2、间距保持一致效果会更美观

建议:可以调整下margin值,例如:

如果我的回答帮到了你,欢迎采纳,祝学习愉快~
相似问题
回答 1
回答 1
回答 1
回答 1
回答 1