弹性布局。

来源:3-13 编程练习

小彬__

2018-10-05 12:07:40

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

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

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
      /*在此处补充代码*/
      header{
          width:100%;
          height:60px;
          background:#000;
          display:flex;
          justify-content:space-between;
      }
      .logo{
        width: 230px;
        display: flex;
        flex-direction: row-reverse;
      }
      .nav{
          width: 250px;
          list-style:none;
          display: flex;
          justify-content: space-between;
          color:#fff;
      }
      .nav li{
        width: 32px;
      }
      .login{
        margin-right: 20px;
        width: 120px;
        display: flex;
        align-items: center;
        justify-content: space-around;
      }

    </style>
</head>
<body>
   <header>
     <div class="logo">
       <img src="http://climg.mukewang.com/59feb59700019dab01910057.png" 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>
</body>
</html>

导航项为什么会出现40px的空间。

padding-start:40px。

写回答

1回答

好帮手慕星星

2018-10-07

是因为设置nav宽度为250px和justify-content属性之后产生的效果,计算器会自己计算,然后均分宽度显示出来。

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

右侧的两个按钮是需要设置样式的哦,背景颜色,没有边框,有圆角等。

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

需要自己完善下,祝学习愉快~~

0

0 学习 · 5012 问题

查看课程