老师代码对吗
来源:3-17 编程练习
情分的小前端
2021-03-23 09:07:14
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title></title>
<style>
/* 在此处补充代码*/
* {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
header {
height: 80px;
width: 100%;
background-color: black;
display: flex;
align-items: center;
justify-content: space-around;
}
.logo {
width: 191px;
}
.logo img {
height: 57px;
}
.nav {
width: 400px;
display: flex;
justify-content: space-around;
align-items: center;
}
.nav li {
/* width: 100px; */
color: white;
font-size: 20px;
}
.login {
width: 180px;
display: flex;
justify-content: space-around;
align-items: center;
}
.login input {
width: 50px;
height: 25px;
background-color: orange;
color: white;
border: none;
outline: none;
cursor: pointer;
}
section {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
}
.section {
display: flex;
width: 45%;
margin: 20px;
justify-content: space-around;
align-items: center;
background-color: rgba(38, 170, 231, 0.5);
border-radius: 10px;
}
.section .box{
display: flex;
flex-direction: column;
}
.section .box p,div{
grid-row: 1;
margin: 5px 0 5px 0;
}
.section .shopping{
display: flex;
}
.section .shopping .btn{
background-color: orange;
border-radius: 8px;
padding: 8px;
cursor: pointer;
color: white;
font-weight: bold;
}
</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月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月CSS3实现动态网页》</p>
<div>适用人群:有html和css基础的童鞋</div>
<div>费用:¥599</div>
</div>
<div class="shopping">
<div class="btn">加入购物车</div>
</div>
</div>
</section>
</body>
</html>
1回答
好帮手慕久久
2021-03-23
同学你好,代码正确,可做如下优化:
头部右侧按钮,缺少圆角,效果不太好看。建议添加上,如下:
祝学习愉快!
相似问题