老师,我的这个写的有问题吗?

来源:3-17 编程练习

墨莫

2021-04-06 19:37:39

<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title></title>
<style>
* {
margin: 0;
padding: 0;
}

/*在此处补充代码*/
header {
box-sizing: border-box;
/* border: 1px solid red; */
display: flex;
width: 100%;
height: 100px;
justify-content: space-between;
align-items: center;
background-color: black;
padding: 10px 30px;
}

ul {
/* box-sizing: border-box;
border: 1px solid green; */
display: flex;
width: 40%;
justify-content: space-between;
align-items: center;
color: white;
font-size: 36px;
list-style: none;
}

.login {
display: flex;
width: 10%;
/* box-sizing: border-box;
border: 1px solid green; */
justify-content: space-between;
}

.login input {
border-radius: 3px;
background-color: yellow;
border-color: rgba(0, 0, 0, 0);
}

/* 主体内容 */
section {
width: 100%;
height: 500px;
box-sizing: border-box;
/* background-color: rgb(192, 79, 192); */
font-size: large;

display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
padding: 20px;
}

section .section {
width: 40%;
height: 200px;
background-color: rgb(192, 79, 192);
border-radius: 10px;


display: flex;
justify-content: space-between;

}

section .section .box {
flex-grow: 1;
/* background-color: purple; */
padding: 10px;


display: flex;
flex-direction: column;
/* align-items: center; */
justify-content: space-around;
}

section .section .shopping {
/* background-color: rebeccapurple; */
display: flex;
flex-direction: column;
/* align-items: center; */
padding: 10px;

justify-content: space-around;
}

section .section .shopping .btn {
padding: 10px;
border-radius: 5px;

background-color: rgb(167, 167, 38);
color: rgb(255, 255, 255);
cursor: pointer;
}
</style>
</head>

<body>
1、logo、导航项、登陆注册按钮这3项在水平和垂直方向上都对齐,而且它们之间的距离也相等。

2、导航项各项之间的距离是一样的。

3、登录、注册按钮之间的距离也是一样的。
<header>
<div class="logo">
<img src="http://climg.mukewang.com/59feb59700019dab01910057.png" 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-07

同学你好,整体思路是没有问题的,可以参考下面的建议优化下样式,效果实现会更好。

1、调整顶部导航项的文字大小为20px

http://img.mukewang.com/climg/606d10c209911e6a06660399.jpg

2、调整登录、注册按钮的背景颜色为橙色,字体为白色,并设置内边距,效果会更好,示例:

http://img.mukewang.com/climg/606d111209a0e7d407620268.jpg

3、调整主体卡片的水平方向对齐方式为space-around

http://img.mukewang.com/climg/606d11cc099e1e9608380444.jpg

4、调整主体卡片的背景颜色为#add8e6,更符合练习效果。

http://img.mukewang.com/climg/606d11ae09ceb97b08450316.jpg

5、调整卡片上的按钮背景为橘色

http://img.mukewang.com/climg/606d12000945571a08060271.jpg

祝学习愉快~

0

0 学习 · 15276 问题

查看课程