多列等分布局

2018-09-26  本文已影响2人  igor_d140
123.png
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>columns</title>
</head>
<style>
  body{
    padding: 0;
    margin: 0;
  }
  th{
    background-color: green;
    height: 50px;
    border:0;
  }
  table{
    width: 100%;
    border-spacing: 0;
    border:0;
  }
  .flex{
    display: flex;
    width: 100%;
    height: 50px;
  }
  .flex .item{
    background-color: pink;
    flex: 1;
  }
  .grid {
    display: grid;
    grid-template-columns: auto auto auto;
  }
  .grid .item{
    background-color: lightgreen;
    height: 50px;
  }
  .cell{
    width: 100%;
    height: 50px;
    display: table;
  }
  .cell .item{
    display: table-cell;
    height: 50px;
    background-color: lightblue;
  }
  .column{
    column-count: 3;
    -webkit-column-count:3;
    column-gap: 0;
  }
  .column .item{
    background-color: purple;
    height: 50px;
  }
</style>
<body>
  <table>
    <thead>
      <th></th>
      <th></th>
      <th></th>
    </thead>
  </table>
  <div class="flex">
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
  </div>
  <div class="grid">
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
  </div>
  <div class="cell">
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
  </div>
  <div class="column">
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
  </div>
</body>
</html>
上一篇 下一篇

猜你喜欢

热点阅读