麻烦老师看一下代码有什么问题吗

来源:3-17 编程练习

Yuujio

2021-06-15 21:18:33

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
*{
margin: 0;
padding: 0;
}
header{
width: 100%;
display: flex;
font-size: 20px;
justify-content: space-around;
align-items: center;
background-color: black;
}
header .nav{
width: 600px;
display: flex;
justify-content: space-around;
color: aliceblue;
}
header .nav li{
display: flex;
justify-content: center;
align-content: center;
margin: 20px;
}
header .login{
width: 200px;
display: flex;
justify-content: space-around;
align-items: center;
}
header .login input{
width: 50px;
height: 30px;
border: 1px solid rgb(224, 154, 24);
border-radius: 5px;
background-color: rgb(224, 154, 24);
}
section{
margin-top: 20px;
height: 100%;
display: flex;
justify-content: space-around;
align-content: space-around;
align-items: center;
}
section .section{
width: 40%;
height: 160px;
background-color: rgba(96, 196, 226, 0.726);
border-radius: 5px;
display: flex;
justify-content: space-around;
align-items: center;
}
section .section .box{
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-around;

}
.box div{
line-height: 30px;
}
.shopping .btn{
width: 100px;
height: 45px;
background-color: orange;
text-align: center;
line-height: 45px;
border-radius: 10px;
color: white;
}
</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>
</section>
</body>
</html>


写回答

1回答

好帮手慕星星

2021-06-16

同学你好,代码还需要调整:

1、logo图与父盒子之间有间隙

http://img.mukewang.com/climg/60c958bb09844c6004440123.jpg

这是因为图片为内联元素,有文字特性,默认存在间隙。可以将图片设置为块元素

http://img.mukewang.com/climg/60c958ef090db42102860109.jpg

2、按钮字体颜色建议与效果图保持一致,设置为白色

http://img.mukewang.com/climg/60c9590c09d8a7ce02340061.jpg

http://img.mukewang.com/climg/60c95938097d996c05640252.jpg

3、下面内容应该是两行,可以复制补充上

http://img.mukewang.com/climg/60c95975096b5dd804740354.jpg

这时候变为了一行显示

http://img.mukewang.com/climg/60c9597f09f2e20c19200242.jpg

还需要调整样式,添加换行以及间隙,参考:

http://img.mukewang.com/climg/60c959d10932c3e506220562.jpg

自己再测试下,祝学习愉快!

0

0 学习 · 15276 问题

查看课程