老师 麻烦检查下
来源:3-17 编程练习
慕容3245546
2019-09-18 14:40:55
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
/* 在此处补充代码*/
*{
margin:0;padding:0;
}
header,section,.nav,.login{
display: flex;
}
header{
margin:auto;
background-color: #000;
width:1000px;
}
.nav{
list-style: none;
color:#ccc;
width:700px;
justify-content: space-around;
align-items: center;
}
.login{
width:200px;
justify-content: space-around;
color:#ccc;
align-items: center;
}
input{
background-color: orange;
border:none;
border-radius: 3px;
color:#fff;
}
section{
flex-wrap: wrap;
align-content: center;
justify-content: center;
align-items: center;
}
.section{
width:450px;
height: 150px;
background-color: rgb(78, 197, 197);
display: flex;
margin:10px 20px 5px 5px;
border-radius: 5px;
align-items: center;
justify-content: space-around;
}
.box{
display: flex;
flex-direction: column;
justify-content: space-around;
height: 100%;
}
.shopping{
background-color:orange;
color:#ccc;
border-radius: 3px;
}
input:hover{
color:red;
}
</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回答
好帮手慕星星
2019-09-18
同学你好,
在全屏下代码实现效果如下:
自己测试可能不是这种效果。由于每个显示器的分辨率不同,宽度也会不同。这边将浏览器宽度缩小就正常了:
建议优化代码:
将header宽度设置为100%,也用flex布局:
将图片设置为块元素,去掉与父容器之间的间隙
完善右侧两个按钮:
每个小盒子宽度修改为百分比
可以重新修改测试下,祝学习愉快!
相似问题