老师,这样是对的吗?有没有什么要修改的,感觉写完有点乱

来源:5-2 编程练习

李可意

2019-10-24 18:13:04

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
     /* 在此处补充代码*/
    header{
        background: #000;
        display: flex;
        justify-content: space-around;
        align-items: center;
    }
    .nav{
        display: flex;
        width: 500px;
        justify-content: space-around;
    }
    ul li{
        color: #fff;
        list-style: none;
    }
    .login{
        width: 120px;
        display: flex;
        justify-content: space-around;
    }
    input{
        width: 42px;
        height: 28px;
        color: #fff;
        background: orange;
        border: 0;
        border-radius: 4px;
        font-size: 14px; 
    }

    section{
        display: flex;
        flex-wrap: wrap;
        justify-content: space-around;
    }
    .section{
        width: 800px;
        height: 200px;
        background: pink;
        border-radius: 10px;
        display: flex;
        justify-content: space-around;
        align-items: center;
        margin-top: 20px;
    }
    .box{
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        height: 200px;
    }
    .btn{
        width: 100px;
        height: 50px;
        line-height: 50px;
        color: #fff;
        background: orange;
        text-align: center;
        border-radius: 10px;
        font-weight: bold;
    }
    .btn:hover{
        color:#808080;
        cursor:pointer;
    }
    </style>
</head>
<body>
<!-- 头部 -->
   <header>
     <div class="logo">
       <img src="http://img1.sycdn.imooc.com\/climg/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回答

好帮手慕星星

2019-10-24

同学你好,

整体布局效果不错,很棒哦!

优化建议:

1、顶部logo与父容器之间有间隙:

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

是因为图片为内联元素,有文字特性,默认存在间隙,可以将图片设置为block元素。如下:

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

其他样式不需要修改了。

祝学习愉快!欢迎采纳~

0

0 学习 · 5012 问题

查看课程