为什么购物车无法居中?谢谢~

来源:5-2 编程练习

慕粉1030219053

2018-05-23 17:58:26

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title></title>

    <style>

      /*在此处补充代码*/

      header,

      .nav,

      .login{

      display: flex;

      justify-content: space-around;

      align-items:center;

      align-content: center;

      }

      header{

      background: black;

      color:white;

      }

      .nav{

      width: 480px;

      }

      .nav li{

      /*width: 30px;*/

    list-style: none;

    font-size: 20px;

      }

      input{

      margin: 0 5px;

      background: orange;

      }

      section{

      display: flex;

      flex-wrap: wrap;

      width: 100%;

      justify-content: space-around;

      font-size:20px;

      }

      .section{

      width: 48%;

      height: 150px;

      background: #abcdef;

      margin-top: 20px;

      border-radius:8px;

      display: flex;

      justify-content: space-around;     

      }

      .shopping{

      width:120px;

      height: 30px;

      background:orange;

      color:white;

      border-radius: 6px;   

      display: flex;

      justify-content: center;

      align-items:center;

      .shopping:hover{

      color:black;

      font-size:22px;

      }


      .box{

      display: flex;

      flex-direction:column;

      justify-content:center;

      }

    </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回答

好帮手慕夭夭

2018-05-23

经过测试 ,按钮css样式建议如下修改:

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

自己完善一下吧 ,祝学习愉快 !

0

0 学习 · 5012 问题

查看课程