5-2编程练习,请老师检查

来源:5-2 编程练习

鹿人神经粉

2019-07-21 08:01:44

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>无标题文档</title>
<style>

* {
            margin:0;
            padding:0;
list-style: none;
        }
header{width:100%;height:100px;background: black;color:white;display: flex;}
.logo{float: left;display: flex;justify-content: center;align-items: flex-start;margin:0 130px;}

.nav{width:800px;display: flex;justify-content:space-around;float: left;margin-right: 100px;}
.nav>li{float:left;line-height:100px;font-size: 24px;color: white;}


           

/*ul的属性.nav不需要写display: block;写弹性布局的属性*/
/*font-size: 16px;之类的属性要写在具体的.login>input里,像移动端的弹性布局属性要写在外边一层*/
.login{display:flex;float:left;}
.login>input{color: #fff;background: orange;border-radius: 5px;box-shadow:0 0 5px 3px orange; width:80px;height:30px;display: flex;float:left;margin-left: 30px;justify-content:center;margin-top: 35px;font-size: 16px;}


section{display: flex;  justify-content: space-around;}
/*section>.section{background: #E58424;float: left;display: flex;color:white;}*/
section>.section:nth-child(1){background: #E58424;float: left;display: flex;color:white;}
section>.section:nth-child(2){background: #2246CF;float: left;display: flex;color:white;}

.section{
            width: 500px;
            height: 120px;
   
            padding: 16px;
           /* margin:100px;*/
            box-sizing: border-box;

            background: #fbfbfb;
            color: #666666;
 
            display: flex;
            justify-content: space-between;
        }
.btn {
            width: 130px;
            height: 60px;
            line-height: 60px;
           
            background: #ffffff;
            color:white;
           
            background: orange;
            border-radius: 4px;
           
            text-align: center;
        
        }
.shopping{display: flex;
            justify-content: center;
align-items: center;
           }
.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>
    </section> 
</body>
</html>

写回答

1回答

好帮手慕码

2019-07-21

同学你好!

代码中的问题:

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

并且,可以给section设置一定的上边距,拉开和头部的距离

如果帮助到了你 欢迎采纳 祝学习愉快~

0

0 学习 · 5012 问题

查看课程

相似问题