请老师检查一下
来源:3-17 编程练习
_Lavender_
2021-03-12 09:53:42
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
*{
margin: 0;
padding: 0;
}
header {
display: flex;
justify-content: space-around;
align-items: center;
background-color: #000;
}
header .nav {
list-style: none;
display: flex;
/* align-items: center; */
}
header .nav li {
width: 120px;
font-size: 24px;
color: #fff;
}
.login {
width: 95px;
display: flex;
justify-content: space-between;
}
.login input {
height: 30px;
width: 40px;
background-color: orange;
color: #fff;
border: none;
border-radius: 4px;
/* padding-right: 10px; */
}
section {
height: 500px;
display: flex;
flex-wrap: wrap;
/* background-color: orange; */
/* flex:1; */
justify-content: space-around;
align-content: space-around;
}
section .section {
height: 200px;
width: 640px;
display: flex;
justify-content: space-around;
background-color: pink;
border-radius: 10px;
}
section .section .box {
font-size: 24px;
display: flex;
flex-direction: column;
justify-content: space-around;
/* align-items: ; */
}
section .section .shopping {
display: flex;
align-items: center;
/* background-color: orange; */
}
section .section .shopping .btn {
display: flex;
align-items: center;
justify-content: center;
background-color: orange;
height: 40px;
width: 100px;
color: #fff;
border-radius: 4px;
}
</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>《从H5网页开发到移动端响应式开发》</p>
<div>适用人群:有html、css、js、jQ基础的童鞋</div>
<div>费用:¥599</div>
</div>
<div class="shopping">
<div class="btn">加入购物车</div>
</div>
</div>
<div class="section">
<div class="box">
<p>《从H5网页开发到移动端响应式开发》</p>
<div>适用人群:有html、css、js、jQ基础的童鞋</div>
<div>费用:¥599</div>
</div>
<div class="shopping">
<div class="btn">加入购物车</div>
</div>
</div>
</section>
</body>
</html>
1回答
同学你好,老师这边测试,内容没有实现两行两列显示,如下:
参考如下调整:
宽度不要使用固定宽度,不然电脑分辨率大的时候,一行可以放下三个盒子了。建议使用百分比设置
祝学习愉快~
相似问题