4 个回答
<html>
    <head>
        <title>option chain</title>
        <meta charset="utf-8" />
        <style>
            * {
                padding: 0;
                margin: 0;
                box-sizing: border-box;
            }
            .container {
                display: grid;
                grid-template-areas: 'a a b'
                                      'a a c'
                                      'd e c'
                                      'd f g'
                                      'h f g';
                grid-template-columns: 100px 50px 100px;
                grid-template-rows: 100px 40px 50px 50px 60px;
            }
            div>div {
                display: flex;
                justify-content: center;
                align-items: center;
            }
            div>div:nth-of-type(1) {
                grid-area: a;
                background-color: red;
            }
            div>div:nth-of-type(2) {
                grid-area: b;
                background-color: yellow;
            }
            div>div:nth-of-type(3) {
                grid-area: c;
                background-color: green;
            }
            div>div:nth-of-type(4) {
                grid-area: d;
                background-color: gray;
            }
            div>div:nth-of-type(5) {
                grid-area: e;
                background-color: pink;
            }
            div>div:nth-of-type(6) {
                grid-area: f;
                background-color: coral;
            }
            div>div:nth-of-type(7) {
                grid-area: h;
                background-color: cyan;
            }
            div>div:nth-of-type(8) {
                grid-area: g;
                background-color: blue;
            }
            
        </style>
    </head>
    <body>
        <div class="container">
            <div>1</div>
            <div>2</div>
            <div>3</div>
            <div>4</div>
            <div>5</div>
            <div>6</div>
            <div>7</div>
            <div>8</div>
        </div>
    </body>
</html>

这样试试

  1. absolute
  2. table
  3. grid

其他的 flex、文档流、float、或者(row、col栅格化)之类的应该不行,他们对于多行这种有点无力。

TABLE 可以做

<html>
<head>
  <style type="text/css">
    table {border-collapse:collapse;}
  table tr {height:2em;line-height:2em;}
  table tr td {min-width:2em;}
  </style>
</head>
<body>
  <table border="1">
    <tbody><tr>
      <td colspan="2" rowspan="2">图1</td>
      <td colspan="2">烧烤类</td>

    </tr>
    <tr>
      <td colspan="2" rowspan="2">图2</td>
    </tr>
    <tr>
      <td rowspan="2">图3</td>
      <td>炒菜类</td>
    </tr>
    <tr>
      <td colspan="2" rowspan="2">图4</td>
      <td rowspan="2">湘菜系列</td>
    </tr>
    <tr>
      <td>川菜系列</td>
    </tr>
  </tbody>
  </table>
</body>
</html>
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题