请老师检查作业
来源:3-3 编程练习
晓之蛇
2022-06-07 18:02:20
老师您好,
请老师检查作业,看下还有什么可以优化的地方,谢谢!
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> /* 1、主体内容的卡片一行只能显示两个。 2、卡片与卡片之间的距离相等,行与行之间的距离也相等。 3、卡片的主体内容居中显示。 */ /* 在此处补充代码*/ /* css-reset */ * { padding: 0; margin: 0; } ul { list-style: none; } /* header */ header { display: flex; justify-content: space-between; background-color: black; color:#fff; font-size:18px; } header .logo { padding-left: 30px; } header .logo img { width: 180px; } header .nav { display: flex; align-items: center; width: 400px; justify-content: space-between; } header .login { width: 100px; padding-right: 30px; display: flex; justify-content: space-between; align-items: center; } header .login input[type="button"] { outline: none; border: none; background: none; background-color: orange; color: #fff; padding: 3px; border-radius: 3px; cursor: pointer; } /* 主体内容 */ section { display: flex; flex-wrap: wrap; justify-content: space-around; font-size: 14px; } section .section { width:40%; height: 120px; margin: 10px 20px; background-color: #43b0be82; display: flex; justify-content: space-around; align-items: center; } section .section .box{ height: 100%; display: flex; flex-direction: column; justify-content: space-around; } section .section .shopping{ background-color: orange; color: #fff; padding: 10px; border-radius: 10px; font-weight: bold; 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>《从H5网页开发到移动端响应式开发》</p> <div>适用人群:有html、css、js、JQ基础的同学</div> <div>费用:¥599</div> </div> <div class="shopping"> <div class="btn">加入购物车</div> </div> </div> <div class="section"> <div class="box"> <p>《从H5网页开发到移动端响应式开发》</p> <div>适用人群:有html、css、js、JQ基础的同学</div> <div>费用:¥599</div> </div> <div class="shopping"> <div class="btn">加入购物车</div> </div> </div> </section> </body> </html>
1回答
同学你好 ,代码实现整体可以。
但样式上还可以进行优化:
1、logo图与父盒子之间有间隙
这是因为图片为行内元素,有文字特性,默认存在间隙。可以将图片设置为块元素
2、下面四个块盒子也需要有圆角效果,可以补充上
祝学习愉快!