老师,检查一下,有没有完善的地方,谢谢

来源:3-17 编程练习

superman888

2020-08-22 11:31:34

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title></title>

<style>

 *{margin: 0;padding: 0; }

 header{width: 100%;height: 80px;display: flex;justify-content: space-around;

background: black;}

 header .logo{width: 200px;}

 header .logo img{width: 240px;height: 80px;}

 header .nav{width: 400px;display: flex;justify-content: space-between;

  align-items: center;}

 header .nav>li{list-style: none;font-size: 24px;color: white;}

 header .login{width: 150px;display: flex;justify-content: space-around;

align-items: center;}

 header .login input{font-size: 18px;padding: 2px;background: orange;

  border: none;color: white;border-radius: 4px; }

 section{

  width: 100%;height: 150px;

  display: flex;justify-content: space-around;

 }

 section .section{height: 100%;width: 620px;display: flex;justify-content: space-around;

  border-radius: 14px;background: rgb(173,216,230);margin-top: 20px;}

 section .section .box{height: 100%;display: flex;flex-direction: column;

  justify-content: space-around;font-weight: bold;}

 section .section .shopping{display: flex;align-items: center;}

 section .section .shopping .btn{width: 80px;height: 20px;background: orange;

  color: white;font-weight: bold;padding: 10px 10px;border-radius: 6px;}

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

    </section>  

</body>

</html>


写回答

1回答

好帮手慕久久

2020-08-22

同学你好,代码中有如下问题:

1. logo图的父元素,没有完全包裹图片:

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

建议不给父元素设置宽度,宽度由内容撑开,如下:

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

2. 优化建议:按钮的间距可增大些,让样式更好看:

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

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

3. 添加4个内容后,内容不换行显示:

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

可设置内容换行,如下:

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

另外,子元素的宽度可以设置成百分比:

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

如果我的回答帮到了你,欢迎采纳,祝学习愉快!

0

0 学习 · 6815 问题

查看课程