请老师帮忙检查下代码并解答下疑惑

来源:5-2 编程练习

人生的起源

2019-07-27 00:22:09

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
     /* 在此处补充代码*/
     * { margin: 0; padding: 0; }
     ul, li { list-style: none; }
     header {
        background: #000;
        display: flex;
        justify-content: space-around;
        align-items: center;
     }
     .nav {
        color: #fff;
        flex-basis: 636px;
        display: flex;
        justify-content: space-between;
     }
     .nav li {
        font-size: 30px;
     }
     .login {
        flex-basis: 154px;
        display: flex;
        justify-content: space-between;
     }
     .login input {
        border: 0;
        background: #ffa500;
        color: #fff;
        font-size: 24px;
        border-radius: 4px;
        padding: 5px;
        cursor: pointer;
     }
     section {
        height: 460px;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-around;
        align-content: space-around;
     }
     .section {
        background: #add8e6;
        border-radius: 10px;
        font-size: 24px;
        height: 200px;
        flex-basis: 864px;
        display: flex;
        justify-content: space-around;
     }
     .section .box {
        flex-basis: 492px;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
     }
     .section .shopping {
        display: flex;
        align-items: center;
     }
     .section .btn {
        font-size: 24px;
        background: #ffa500;
        color: #fff;
        border-radius: 10px;
        padding: 15px;
        cursor: pointer;
     }
    </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、jQ基础的童鞋</div>
        <div>费用:¥499</div>
      </div>
      <div class="shopping">
        <div class="btn">加入购物车</div>
      </div>
    </div>
    <div class="section">
      <div class="box">
        <p>《从H5网页开发到移动端响应式开发》</p>
        <div>适用人群:有html、css、js、jQ基础的童鞋</div>
        <div>费用:¥499</div>
      </div>
      <div class="shopping">
        <div class="btn">加入购物车</div>
      </div>
    </div>
    </section>  
</body>
</html>

请老师帮忙看下代码还有什么需要改进的,并帮忙解答个问题
http://img.mukewang.com/climg/5d3b28010001867212700685.jpg

请问几个卡片竖直方向的间距,如上图3个红框所示,要用flex的什么属性才能让它们相等(在不用margin的情况下),我试了好几个属性都不行。。。

写回答

1回答

好帮手慕言

2019-07-27

同学你好,

1、页面缩小到一定程时,一行只有一项显示,原因是主轴方向上的初始大小是固定值

建议:设置成百分比。

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

2、红框标注的距离使用flex不能设置成一样的,可以调整margin值。

3、当鼠标放在按钮上时,按钮上的文字颜色应该发生变化哦。

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

祝学习愉快~

0

0 学习 · 5012 问题

查看课程