老师帮忙看下有什么可以改进的

来源:5-2 编程练习

精慕门9328699

2019-01-15 19:53:47

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title></title>

    <style>

     *{margin: 0;padding: 0;}

      header{

        background: #000;

        color: #fff;

        display: flex;

        justify-content: space-around;

        align-items: center;

        font-size: 24px;

      }

      ul{

        list-style: none;

      }

      .logo>img{

        width: 220px;

      }

      .nav{

        display: flex;

        justify-content: space-around;

        width: 550px;

      }

      .login{

        display: flex;

        justify-content: space-around;

        width: 150px;

      }

      .login>input{

        width: 50px;

        height: 32px;

        font-size: 18px;

        color: #fff;

        background: orange;

        outline: none;

        border: none;

        border-radius: 6px;

      }

      section{

        display: flex;

        justify-content: space-around;

        font-size: 18px;

        flex-wrap: wrap;

      }

      .section{

        display: flex;

        justify-content: space-around;

        width: 700px;

        background: #abcdef;

        height: 150px;

        border-radius: 10px;

        margin-top: 20px;

      }

      .shopping{

        display: flex;

        align-items: center;

      }

      .btn{

        color: #fff;

        width: 120px;

        height: 40px;

        line-height: 40px;

        background: orange;

        font-weight: bold;

        text-align: center;

        border-radius: 6px;

      }

      .box{

        display: flex;

        flex-direction: column;

        justify-content: space-around;

        width: 400px;

      }

      .login>input:hover{

        color: red;

        cursor: pointer;

      }

      .shopping>.btn:hover{

        color: red;

        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>《前端小白入门手册》</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>

  </section>  

</body>

</html>


写回答

1回答

好帮手慕星星

2019-01-16

你好,当浏览器缩小到一定程度时,一行就一项显示了:

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

代码中给.section设置的宽度为700px,是固定的,所以会出现这种情况,建议修改成百分比。

自己再测试下,祝学习愉快!

0

0 学习 · 5012 问题

查看课程