老师这样可以吗
来源:3-17 编程练习
周家荣
2020-05-08 02:01:10
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
/* 在此处补充代码*/
*{padding:0;margin:0;}
header{
width:1000px;
height:100px;
margin:0 auto;
background:black;
display:flex;
flex-direction:row;
justify-content:space-around;
align-items:center;
}
.nav{
width:300px;
display: inline-flex;
justify-content: space-around;
}
.nav li{list-style: none;color:white; cursor:pointer;}
.login{
display: inline-flex;
justify-content: space-between;
}
.login input{
border-radius: 5px;
margin:0 10px;
background-color: orange;
border: none;
cursor:pointer;
}
section{margin:10px auto;width:1000px;height:450px;display:flex;justify-content:space-around;flex-wrap:wrap;}
.section{width:400px;height:160px;background-color: rgb(145, 200, 226);border-radius:8px;display:flex;flex-direction:row;justify-content:center;}
.section > .box{height:100%;display:flex;flex-direction:column;justify-content:space-around;}
.section .shopping{display:flex;flex-direction:column;justify-content:center;}
.section .shopping .btn{font-size:12px;width:80px;text-align:center;height:40px;line-height:40px;margin-left:20px;color:white;background:orange;border-radius:8px;cursor:pointer;}
.section .shopping .btn:hover{color:black;}
</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-05-08
同学你好,参考如下优化样式即可:
1.导航设置固定宽度,在分辨率大的电脑上,页面无法横向铺满。建议改为宽度100%效果更好:
2.按钮设置一些内边距
如果我的回答帮助到了你,欢迎采纳,祝学习愉快~
相似问题