美文网首页
九宫格实现

九宫格实现

作者: 六寸光阴丶 | 来源:发表于2019-09-30 19:06 被阅读0次

效果

九宫格

代码

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Flex布局</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    .box {
      width: 800px;
      height: 800px;
      background-color: blue;
      display: flex;
      flex-direction: column;
      justify-content: space-around;
    }
    .sub {
      width: 100%;
      display: flex;
      justify-content: space-around;
      align-items: center;
    }
    .item {
      background-color: red;
      height: 200px;
      width: 200px;
      line-height: 200px;
      text-align: center;
    }
  </style>
</head>
<body>
  <div class="box">
    <div class="sub">
      <div class="item">
        子项目
      </div>
      <div class="item">
        子项目
      </div>
      <div class="item">
        子项目
      </div>
    </div>
    <div class="sub">
      <div class="item">
        子项目
      </div>
      <div class="item">
        子项目
      </div>
      <div class="item">
        子项目
      </div>
    </div>
    <div class="sub">
      <div class="item">
        子项目
      </div>
      <div class="item">
        子项目
      </div>
      <div class="item">
        子项目
      </div>
    </div>
  </div>
</body>
</html>

相关文章

网友评论

      本文标题:九宫格实现

      本文链接:https://www.haomeiwen.com/subject/qbrluctx.html