老师帮忙看下,有没有改进的地方,谢谢
来源:3-17 编程练习
曼曼前端
2021-10-20 15:21:36
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>编程练习3-17</title>
<style>
/* 在此处补充代码*/
*{
padding: 0;
margin: 0;
list-style: none;
}
header{
background-color:rgb(7, 7, 7);
display: flex;
justify-content: space-around;
}
.nav{
width: 30%;
display: flex;
justify-content: space-around;
align-items: center;
}
.nav li{
color: #fff;
}
.login{
width: 150px;
display: flex;
align-items: center;
justify-content: space-between;
}
.login input{
width: 60px;
height: 25px;
background-color: rgba(245, 213, 35, 0.795);
border: none;
border-radius: 3px;
color: #fff;
}
section{
height: 500px;
width: 100%;
display: flex;
justify-content: space-around;
align-content:space-around;
flex-wrap: wrap;
}
section .section{
height: 200px;
border-radius: 20px;
/* flex-shrink: 0; */
width: 48%;
background-color: rgb(64, 224, 208);
/* text-align: center; */
display: flex;
justify-content: space-around;
}
.box{
display: flex;
flex-direction: column;
justify-content: space-around;
}
.shopping{
display: flex;
align-items: 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网页开发到移动端响应式开发》</p>
<div>适用人群:有html和css、js、jQ基础的童鞋</div>
<div>费用:¥599</div>
</div>
<div class="shopping">
<div class="btn">加入购物车</div>
</div>
</div>
<div class="section">
<div class="box">
<p>《从HTML5网页开发到移动端响应式开发》</p>
<div>适用人群:有html和css、js、jQ基础的童鞋</div>
<div>费用:¥599</div>
</div>
<div class="shopping">
<div class="btn">加入购物车</div>
</div>
</div>
</section>
</body>
</html>
1回答
好帮手慕慕子
2021-10-20
同学你好,整体思路实现是可以的,其中有一个细节需要调整下,如下:
卡片中的“加入购物车”按钮左侧没有对齐显示,也没有设置背景颜色,示例:
建议调整:给卡片添加box-sizing:border-box; 通过给卡片添加左右padding值调整内容与盒子之间的空白间距,然后调整为两端对齐(space-between),实现按钮对齐显示效果。
设置按钮样式
祝学习愉快~
相似问题