3-17编程练习还有不足的地方吗,能帮我看下吗?

来源:3-17 编程练习

YoLo_H

2020-07-24 10:49:23

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
     /* 在此处补充代码*/
     *{
         margin:0;
         padding:0;
         box-sizing: border-box;
     }
     body{
         width:100%;
     }
     header{
         display:flex;
         justify-content: space-around;
         align-items: center;
         width:100%;
         background: #000000;
     }
     ul.nav{
         display:flex;
         justify-content: space-around;
         align-items: center;
         color:white;
         list-style-type: none;
         width:50%;
         font-size:20px;
     }
     div.login{
        width:100px;
        display:flex;
        justify-content: space-around;
        align-items: center;
     }
     div.login input{
         font-size:14px;
         border:none;
         color:white;
         background:#FFA500;
         padding:2px;
         border-radius: 3px;
     }
     section{
        width          :100%;
        height:300px;
        display        :flex;
        justify-content: space-around;
        align-items    : center;
        flex-wrap      : wrap;
        flex-direction: row;

     }
     div.section{
        width:45%;
        height:115px;
        background:#ADD8E6;
        display        :flex;
        justify-content: space-around;
        align-items    : center;
        font-weight: 600;
        font-size:16px;
        border-radius: 5px;
     }
     div.section div.box{
        display        :flex;
        justify-content: space-around;
        flex-direction: column;
        height:100%;
        width:60%;
     }
       div.section div.shopping div.btn{
        color:white;
        background:#FFA500;
        padding:10px 5px;
        border-radius: 5px;
       }
    </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回答

好帮手慕星星

2020-07-24

同学你好,代码布局以及样式是不错的。

但是还有可以优化的地方:logo图片下方有间隙

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

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

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

祝学习愉快!

0

0 学习 · 6815 问题

查看课程