麻烦老师检查,谢谢

来源:3-17 编程练习

qq_慕移动3101913

2020-03-09 15:02:22

<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title></title>
  <style>
    /* 在此处补充代码*/
    * {
      margin: 0;
      padding: 0;
      list-style-type: none;
    }

    header {
      background-color: black;
      display: flex;
      justify-content: space-around;
      align-items: center;
    }

    .logo {
      width: 200px;
      display: flex;
      justify-content: center;
      cursor: pointer;
    }

    .nav {
      width: 500px;
      display: flex;
      justify-content: space-around;
      color: #fff;
      font-size: 20px;
    }

    .nav li {
      cursor: pointer;    /* 鼠标小手 */
    }

    .login {
      width: 200px;
      display: flex;
      justify-content: space-around;
    }

    .login input {
      width: 50px;
      height: 35px;
      color: #fff;
      border: 1px solid orange;
      background-color: orange;
      border-radius: 3px;
      font-size: 15px;
      cursor: pointer;
    }

    section {
      width: 100%;
      height: 600px;

      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-around;
      

    }

    .section {
      width: 700px;
      height: 200px;
      background-color: #ADD8E6;
      border: 1px solid #ADD8E6;
      border-radius: 6px;

      display: flex;
      align-content: center;    /* 水平居中对齐 */
      justify-content: space-around;  /* 每个项目两侧的间隔相等 */

    }

    .box {
      width: 300px;
      /* height: 50px; */
      font-size: 18px;
      text-align: center;
      line-height: 50px;
      font-weight: bold;

      display: flex;
      flex-wrap: wrap;       /* 换行 */
      align-items: center;   /* 垂直上居中对齐 */
    }

    .shopping {
      width: 200px;
      cursor: pointer;

      display: flex;
      justify-content: flex-end;  /* 向右对齐 */
      align-items: center;        /* 垂直上居中对齐 */
      
    }

    .btn {
      width: 130px;
      height: 50px;
      font-size: 20px;
      color: #fff;
      text-align: center;
      line-height: 50px;
      font-weight: bold;
      border: 1px solid orange;
      background-color: orange;
      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>
    <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>
  </section>
</body>

</html>


写回答

1回答

好帮手慕慕子

2020-03-09

同学你好, 如下所示,在大屏幕下打开页面,不符合两行两列的布局效果。

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

建议:使用百分比设置项目的宽度,保证在不同分辨率下打开,呈现的都是两行两列的布局。

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

另,练习要求,鼠标移入按钮时,字体颜色发生改变。建议:给按钮添加伪类hover,设置color属性实现效果。

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

其它部分效果实现的很棒,继续加油!

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

0
hq_慕移动3101913
h 谢谢老师。
h020-03-09
共1条回复

0 学习 · 6815 问题

查看课程