请老师检查,我这样写对吗? 我加了高度,我感觉好像不太对
来源:5-2 编程练习
慕前端2064318
2019-08-15 00:07:12
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title></title>
<style>
/* 在此处补充代码*/
* {
padding: 0px;
margin: 0px;
}
header {
background-color: black;
display: flex;
justify-content: space-around;
align-items: center;
}
.nav {
width: 300px;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 18px;
}
li {
color: white;
list-style: none;
}
.login input {
background-color: orange;
border: none;
border-radius: 5px;
color: white;
margin: 0 5px;
font-size: 18px;
}
section {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
}
section .section {
width: 45%;
height: 100px;
background-color: #abcdef;
border-radius: 5px;
display: flex;
margin: 10px;
padding: 10px;
justify-content: space-around;
}
section .section .box {
display: flex;
flex-direction: column;
justify-content: space-between;
}
section .section .shopping {
display: flex;
align-items: center;
}
section .section .shopping .btn {
background-color: orange;
color: white;
border-radius: 5px;
font-weight: 700;
padding: 10px;
}
</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回答
同学你好,这样写是可以的, 整体实现效果不错。
不过下图所示, 练习要求没有实现哦

建议:可以给按钮添加hover样式设置color属性

如果帮助到了你, 欢迎采纳!
祝学习愉快~~~
相似问题
回答 1
回答 1