老师帮忙检查一下
来源:3-17 编程练习
ToExpress
2021-04-20 17:41:02
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
/* 在此处补充代码*/
* {
margin: 0;
padding: 0;
}
header {
box-sizing: border-box;
display: flex;
width: 100%;
height: 100px;
justify-content: space-between;
align-items: center;
padding: 10px 30px;
background: #000;
}
.nav {
display: flex;
list-style: none;
width: 40%;
font-size: 24px;
justify-content: space-between;
color: rgb(250, 243, 243);
}
.login {
display: flex;
width: 8%;
justify-content: space-between;
}
.login input {
background: rgb(238, 190, 57);
border-radius:3px;
border-color: rgba(0, 0, 0, 0);
}
section{
display: flex;
width: 100%;
height: 300px;
flex-wrap: wrap;
justify-content: space-around;
box-sizing: border-box;
align-items:center;
}
.section{
display: flex;
background: rgb(150, 218, 247);
width:45%;
box-sizing: border-box;
height:130px;
border-radius: 5px;
justify-content: space-around;
align-items: center;
}
.box{
display: flex;
box-sizing: border-box;
width:40%;
height: 90%;
flex-wrap: wrap;
align-items: center;
}
.shopping{
display:flex;
background:rgb(238, 190, 57);
width:18%;
height:25%;
font-size:20px;
justify-content: center;
align-items: center;
border-radius: 5px;
color: #ffffff;
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回答
好帮手慕慕子
2021-04-20
同学你好,代码中存在的问题解答如下:
1、按钮文字颜色与效果图不符
建议调整字体颜色为白色,并设置适当的padding属性值,效果实现会更美观。
2、卡片的文字布局不对,如下图所示:
原因:父级box盒子能够容纳文字内容在一行显示,所以没有换行显示。
建议:可以给box下的div设置宽度为百分百,让其独占一行显示。
3、按钮中的文字垂直居中存在误差,如下图所示:
建议:去掉按钮的高度,让其由文字撑开高度,然后通过上下padding调整间距,实现垂直居中效果。
4、样式相同的代码,可以使用组合选择器,书写在一起。示例:
祝学习愉快~
相似问题