老师,请检查

来源:3-17 编程练习

慕虎0371676

2021-06-12 16:26:27

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title></title>

    <style>

     /* 在此处补充代码*/

     *{

         margin:0;

         padding:0;

         list-style:none;

     }

     header{

         width:800px;

         height:100px;

         background:#000;

         color:#fff;

         display:flex;

         justify-content:space-between;

         align-items:center;

     }

     .logo{

         margin-left:50px;

     }

     .nav{

         display:flex;

     }

     li{

         margin-right:20px;

     }

     .login{

         margin-right:20px;

     }

     input{

         display:inline-block;

         width:30px;

         height:24px;

         background-color:orange;

         color:#fff;

         border:none;

         border-radius:2px;

         font-size:12px;

     }

     input:last-child{

         margin-left:20px;

     }

     section{

         width:800px;

         display:flex;

         justify-content:space-around;

         flex-wrap:wrap;

     }

     .section{

         width:360px;

         height:80px;

         background-color:Lightblue;

         border-radius:6px;

         margin-top:10px;

         font-size:12px;

         display:flex;

         justify-content:space-around;

         align-items:center;

     }

     .shopping{

          display:flex;

          align-self:center;

     }

     .box{

         line-height:2em;

     }

     .btn{

        width:70px;

        height:20px;

        background-color:orange;

        color:#fff;

        border-radius:4px;

         text-align:center;

         line-height:20px;

     }

    </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-06-12

同学你好,代码中存在的问题解答如下:

1、内容没有全屏显示,如下所示:

http://img.mukewang.com/climg/60c4818c0969c85828780596.jpg

建议:去掉外层盒子的固定宽度,让其自适应窗口的宽度。

http://img.mukewang.com/climg/60c481f4091d575006000358.jpg

http://img.mukewang.com/climg/60c481d20944f38806840254.jpg

经过上述调整后,卡片在一排显示了,如下:

http://img.mukewang.com/climg/60c4822009ecceef28780452.jpg

建议:调整卡片的宽度为百分比,实现两行两列的布局效果。

http://img.mukewang.com/climg/60c4824309e3669b08460494.jpg

2、顶部左右侧距离窗口的间距不同,如下:

http://img.mukewang.com/climg/60c482870965579528780236.jpg

建议:调整按钮到右侧窗口距离为50px,与logo左侧间距保持一致。

http://img.mukewang.com/climg/60c482c809d1f29f05760182.jpg

3、由于给li统一设置右间距,导致ul整体距离左右侧内容的间距不同,如下:

http://img.mukewang.com/climg/60c482f209f1298d07980214.jpg

建议:通过:last-child属性去除最后一个元素的margin-right属性值

http://img.mukewang.com/climg/60c483370976c4f704500144.jpg

祝学习愉快~~


0

0 学习 · 6815 问题

查看课程

相似问题