老师,这样写可以吗?

来源:5-2 编程练习

小慕修行中

2018-05-06 10:13:30

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title></title>

    <style>

     /* 在此处补充代码*/

      *{

          padding:0;

          margin:0;

      }

      header{

          background:black;

          display:flex;

          justify-content:space-around;

          

      }

      .logo{

          display:flex;

      }

      .nav{

          list-style-type:none;

          color:white;

          display:flex;

          justify-content:space-between;

          align-items:center;

      }

      .login{

          display:flex;

          justify-content:space-between;

          align-items:center;

      }

      input{

          background-color:orange;

          width:40px;

          height:40px;

          border-radius:3px;

      }

      /*主体部分*/

      section{

          display:flex;

          width:1020;

          height:200px;

          flex-wrap:wrap;

          align-items:center;

          justify-content:space-around;

      }

      .section{

          background-color:#afa;

          width:450px;

          height:80px;

          border-radius:10px;

          display:flex;

          align-items:center;

          justify-content:space-around;

      }

      .btn{

          background-color:orange;

          color:white;

          width:100px;

          height:30px;

          text-align:center;

          line-height:30px;

          border-radius:10px;

      }

    </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,jQuery基础的童鞋</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,jQuery基础的童鞋</div>

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

      </div>

      <div class="shopping">

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

      </div>

    </div>

    </section>  

</body>

</html>


写回答

1回答

好帮手慕星星

2018-05-07

经测试显示如下:

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

1、顶部部分中间导航各项之间没有分开,右侧的按钮之间也没有分开,可以设置固定的宽度。

2、下面的内容显示在一行,应该分两行显示,可能你自己测试的时候是正常的,但是每个显示器的分辨率不同,显示效果也会不同,建议把div的宽度设置成百分比。

参考修改代码:

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

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

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

自己修改测试下,祝学习愉快~~

0

0 学习 · 5012 问题

查看课程