老师帮忙看一下哈
来源:3-17 编程练习
慕丝329460
2019-06-01 21:26:32
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>3-10练习</title>
<style>
* {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
body {
font-family: "微软雅黑";
}
header {
display: flex;
justify-content: space-around;
align-items: center;
width: 1200px;
margin: 0 auto;
background: #000;
}
.logo img{
display: block;
}
.nav {
display: flex;
justify-content: space-between;
width: 400px;
color: #fff;
}
.login {
display: flex;
justify-content: space-between;
width: 100px;
}
input[type="button"] {
width: 35px;
padding: 3px;
background: orange;
border: 1px solid orange;
border-radius: 3px;
outline: 0;
color: #fff;
}
section {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
align-content: space-around;
width: 1200px;
height: 300px;
margin: 0 auto;
}
.section {
display: flex;
justify-content: space-around;
align-items: center;
width: 45%;
height: 130px;
background: lightblue;
border-radius: 5px;
}
.box {
display: flex;
flex-direction: column;
justify-content: space-around;
height: 100%;
flex-basis: 350px;
/* flex-grow: 4; */
}
.shopping {
/* flex-grow: 1; */
}
.btn {
display: flex;
justify-content: center;
align-items: center;
width: 100px;
height: 36px;
background: orange;
color: #fff;
border-radius: 5px;
line-height: 0;
}
</style>
</head>
<body>
<header>
<div class="logo">
<img src="http://climg.mukewang.com/59feb59700019dab01910057.png" 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>《前端小白入门手册》</p>
<div>适用人群:没有任何前端基础的小白</div>
<div>费用:¥499</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>《前端小白入门手册》</p>
<div>适用人群:没有任何前端基础的小白</div>
<div>费用:¥499</div>
</div>
<div class="shopping">
<div class="btn">加入购物车</div>
</div>
</div>
</section>
</body>
</html>
1回答
同学你好,外层的宽度不需要设置固定的宽度与居中,设置宽度100%即可,例:


希望能帮助到你,欢迎采纳。
祝学习愉快!
相似问题