td 中的多行

2023-12-05

Stores <td>包含多行表。一个商店可以有多个 商店(行)。

参见示例:https://jsfiddle.net/ak3wtkak/1/

商店宽度和数量(<th>) 第二个表中的多行列应相同。如何解决这个问题或者什么是替代方法?

enter image description here

<table border="1" width="100%">
  <thead>
    <tr>
      <th style="width:300px">Product</th>
      <th>Barcode</th>
      <th>Stores</th>
      <th class="middle">Quantity</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
      Item 1
      </td>
      <td>12345</td>
      <td colspan="3">
        <table border="1" width="100%">
          <tbody>
            <tr>
              <td>Store Name 1</td>
              <td class="middle">4</td>
            </tr>
            <tr>
              <td>Store Name 2</td>
              <td class="middle">4</td>
            </tr>
            <tr>
              <td>Store Name 3</td>
              <td class="middle">4</td>
            </tr>
          </tbody>
        </table>
      </td>
    </tr>
  </tbody>
</table>

您必须使用行跨度。 使前 2 行的行跨度为 3。

<table border="1" width="100%">
  <thead>
    <tr>
      <th style="width:300px">Product</th>
      <th>Barcode</th>
      <th>Stores</th>
      <th class="middle">Quantity</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td rowspan="3">Item 1</td>
      <td rowspan="3">12345</td>
      <td>Store Name 1</td>
      <td>4</td>
    </tr>
    <tr>
      <td>Store Name 2</td>
      <td>4</td>
    </tr>
    <tr>
      <td>Store Name 3</td>
      <td>4</td>
    </tr>
  </tbody>
</table>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

td 中的多行 的相关文章