是否还有优化

来源:3-17 编程练习

福徐贵

2020-11-09 18:20:19

# 具体遇到的问题

# 报错信息的截图

# 相关课程内容截图

# 尝试过的解决思路和结果

# 粘贴全部相关代码,切记添加代码注释(请勿截图)

<!DOCTYPE html>

<html>


<head>

<meta charset="UTF-8">

<title></title>

<style>

/* 在此处补充代码*/

* {

padding: 0;

margin: 0;

box-sizing: border-box;

}


header {

background: #000;

display: flex;

justify-content: space-between;

align-items: center;

}


header .logo {

display: flex;

justify-content: space-around;

align-items: center;

}


header .nav {

color: #fff;

list-style-type: none;

display: flex;

flex-basis: 100%;

}


header .nav li {

flex: 1;

display: flex;

justify-content: space-around;

}


header .login {

display: flex;

}


header .login input {

color: #fff;

background: orange;

border: none;

border-radius: 3px;

padding: 4px;

margin: 5px;

}


section {

display: flex;

align-content: space-around;

justify-content: space-around;

flex-wrap: wrap;

height: 500px;


}


section .section {

background: rgb(182, 215, 228);

border-radius: 4px;

display: flex;

justify-content: space-around;

height: 200px;

width: 45%;

}


section .section .box {

display: flex;

flex-direction: column;

flex-wrap: wrap;

justify-content: space-around;


}


section .section .shopping {

display: flex;

flex-basis: 30%;

justify-content: flex-end;

align-items: center;

}


section .section .shopping .btn {

background: orange;

color: #fff;

padding: 7px;

border-radius: 3px;

display: flex;

justify-content: center;

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月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回答

好帮手慕星星

2020-11-09

同学你好,代码布局是可以的,但是顶部太分散了

http://img.mukewang.com/climg/5fa91b660997261b19040103.jpg

建议给中间导航盒子添加固定宽度,按钮添加右侧间距,看起来会美观一些。参考

http://img.mukewang.com/climg/5fa91bf409b511e604120435.jpg

祝学习愉快!

0

0 学习 · 6815 问题

查看课程