编程3-17,请老师查看。
来源:3-17 编程练习
陈莺莺呀
2019-12-11 16:53:20
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
*{
margin:0;
padding:0;
box-sizing:border-box;
}
/* 在此处补充代码*/
header{
display:flex;
align-items:center;
justify-content: space-around;
background-color:black;
color:white;
}
.nav{
display:flex;
align-items:center;
list-style:none;
justify-content: space-between;
}
.nav li{
width:80px;
}
input{
background-color:orange;
border:none;
outline:none;
color:white;
margin:0 5px;
padding:5px;
cursor: pointer;
border-radius:5px;
}
input:hover{
background-color:white;
color:orange;
}
section{
display:flex;
flex-wrap:wrap;
justify-content: space-around;
}
.section{
display:flex;
justify-content: center;
align-items: center;
background:#abcdef;
border-radius: 10px;
padding:10px 40px;
height:200px;
margin-top:20px;
width:46%;
}
.box{
display:flex;
flex-direction:column;
height:100%;
flex: 1;
}
.box p,
.box div{
display:flex;
flex: 1;
align-items: center;
}
.btn{
background-color: orange;
border-radius:5px;
color:white;
padding:8px 10px;
flex: 1;
}
.btn:hover{
background-color: white;
color:orange;
cursor:pointer;
}
</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回答
同学你好,整体布局是不错的,很棒!
优化建议:图片与父容器之间有间隙
这是因为图片为行内元素,有文字特性,默认存在间隙。建议将图片设置为块元素,参考:
如果我的回答帮助到了你,欢迎采纳,祝学习愉快~
相似问题