老师,麻烦帮忙看一下,谢谢。
来源:5-2 编程练习
aleeeeex
2018-12-19 12:13:48
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
/* 在此处补充代码*/
*{
padding: 0;
margin:0;
}
header{
background: #000;
width:100%;
display: flex;
}
.logo{
display: block;
flex: 1;
}
header ul{
color:#fff;
list-style: none;
display: flex;
justify-content: center;
align-items: center;
flex: 1;
}
header ul li{
text-align: center;
flex:1;
}
.login{
flex:1;
display: flex;
justify-content: center;
align-items: center;
}
.login input{
line-height: 20px;
background: orange;
color:#fff;
border: none;
width:50px;
margin: 20px
}
section{
width:90%;
margin:20px auto;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.section{
background: #73b8ef;
width:48%;
display: flex;
margin:20px 0;
height: 150px;
align-items: center;
justify-content: space-around;
border-radius: 10px;
}
.section .box{
display: flex;
flex-direction: column;
width:300px;
height: 100px;
justify-content: space-between;
}
.section .shopping{
width:100px;
background: orange;
line-height: 28px;
text-align: center;
}
</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>《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>《HTML5月CSS3实现动态网页》</p>
<div>适用人群:有html和css基础的童鞋</div>
<div>费用:¥599</div>
</div>
<div class="shopping">
<div class="btn">加入购物车</div>
</div>
</div>
</section>
</body>
</html>1回答
好帮手慕星星
2018-12-19
经测试代码实现效果是可以的,有两个小问题需要完善:
1、顶部左侧logo图片与父容器之间有缝隙:

这是因为图片是inline-block元素,默认存在缝隙,可以给图片设置成block元素。
2、建议给页面中的按钮都添加上圆角:

使用border-radius属性。
自己完善测试下,祝学习愉快!
相似问题