5-2编程练习
来源:5-2 编程练习
慕数据7542861
2018-09-11 16:00:32
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
*{margin: 0;padding: 0;list-style-type: none;}
header{
color: white;
background-color: #000;
width: 100%;
height: 60px;
display: flex;
justify-content: space-around;
}
header>*{
display: flex;
justify-content: center;
align-items: center;
}
header>.logo{width: 20%;}
header>.nav{
width: 30%;
justify-content: space-around;
}
header>.login{width: 20%;}
header>.logo>img{zoom:.6;}
header>.login>input{
color: #FFF;
background-color: orange;
padding: 5px;
outline: 0;
border: 0;
border-radius: 5px;
cursor: pointer;
opacity: 1;
transition: opacity .5s ease;
}
header>.login>input:nth-child(1){margin-right: 30px;}
header>.login>input:hover{
opacity: .7;
transition: opacity .5s ease;
}
section{
width: 100%;
height: 600px;
background-color: #FAFAFA;
display: flex;
flex-wrap: wrap;
justify-content: space-around;
align-content: flex-start;
}
section>.section{
width: 45%;
height: 140px;
border-radius: 20px;
margin-top: 10px;
padding: 10px;
box-sizing: border-box;
background-color: rgb(173,216,230);
display: flex;
justify-content: space-around;
}
section>.section>.box{
display: flex;
flex-direction: column;
justify-content: space-around;
}
section>.section>.shopping{
align-self: center;
}
section>.section>.shopping>.btn{
color: #FFF;
background-color: orange;
padding: 10px;
border-radius: 10px;
cursor: pointer;
transition: background-color .5s ease;
}
section>.section>.shopping>.btn:hover{
background-color: #FF7F24;
transition: background-color .5s ease;
}
</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>老师我行与行之间的距离是使用margin-top实现的可以吗
1回答
经测试是没有问题的呢,上下间距可以使用margin值来实现。继续加油~~