老师,可以吗?

来源:5-2 编程练习

小章鱼丸

2018-12-19 22:59:03

<!DOCTYPE html>


<html>


<head>


    <meta charset="UTF-8">


    <title></title>


    <style>


     *{


      margin:0;


      padding:0;


     }


     ul{


      list-style:none;


      color:#fff;


     }


     header{


      width:100%;


      background:#000;


      display:flex;


      height:70px;


      align-items:center;


      justify-content:space-around;


     }


     header .logo img{


      width:200px;


      display:block;


      margin-left:-40px;


     }


     header .nav{


      display:flex;


      justify-content:space-between;


      width:400px;


      font-size:20px;


     }


     header .login{


      display:flex;


      width:120px;


      justify-content:space-between;


     }


     header .login input{


      background:orange;


      border:none;


      border-radius:3px;


      width:50px;


      height:30px;


      font-size:15px;


      color:#fff;


     }


     section{


      display:flex;


      flex-wrap:wrap;


      display:flex;


      justify-content:space-around;


      padding-top:20px;


     }


     section .section{


      width:500px;


      height:120px;


      background:#abcdef;


      border-radius:10px;


      display:flex;


      justify-content:space-between;


      padding:10px 30px;


      margin-bottom:20px;


     }


     section .section .box{


      display:flex;


      flex-direction:column;


      justify-content:center;


      line-height:40px;


     }


     section .section .shopping{


      display:flex;


      align-items:center;


     }


     section .section .shopping .btn{


      width:96px;


      height:36px;


      line-height:36px;


      color:#fff;


      background:orange;


      font-weight:bold;


      border-radius:5px;


      text-align:center;


     }


     section .section .shopping .btn:hover{


      color:#000;


      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>适用人群:有基础的童鞋</div>


        <div>费用:¥599</div>


      </div>


      <div class="shopping">


        <div class="btn">加入购物车</div>


      </div>


    </div>


    <div class="section">


      <div class="box">


        <p>《从H5网页开发到移动端响应式开发》</p>


        <div>适用人群:有基础的童鞋</div>


        <div>费用:¥599</div>


      </div>


      <div class="shopping">


        <div class="btn">加入购物车</div>


      </div>


    </div>


    </section>  


</body>


</html>





写回答

1回答

好帮手慕星星

2018-12-20

经测试显示效果如下:

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

下面内容不是两行两列显示的,代码中每项设置的宽度为500px,自己测试的时候可能是正常显示的,但是每个下显示器的分辨率不同,显示效果也会不同,所以建议设置每个项的宽度为百分比,参考:

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

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

0

0 学习 · 5012 问题

查看课程