Html table tr inside td

后端 未结 9 2204
余生分开走
余生分开走 2020-12-01 02:41

I am trying to create a table in HTML. I have the following design to create. I had added a inside the but somehow the table

相关标签:
9条回答
  • 2020-12-01 02:50

    You can solve without nesting tables.

    <table border="1">
        <thead>
            <tr>
                <th>ABC</th>
                <th>ABC</th>
                <th colspan="2">ABC</th>
                <th>ABC</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td rowspan="4">Item1</td>
                <td rowspan="4">Item1</td>
                <td colspan="2">Item1</td>
                <td rowspan="4">Item1</td>
            </tr>
            <tr>
                <td>Name1</td>
                <td>Price1</td>
            </tr>
            <tr>
                <td>Name2</td>
                <td>Price2</td>
            </tr>
            <tr>
                <td>Name3</td>
                <td>Price3</td>
            </tr>
            <tr>
                <td>Item2</td>
                <td>Item2</td>
                <td colspan="2">Item2</td>
                <td>Item2</td>
            </tr>
        </tbody>
    </table>

    0 讨论(0)
  • 2020-12-01 02:53

    Full Example:

    <table border="1" style="width:100%;">
      <tr>
        <td>ABC</td>
        <td>ABC</td>
        <td>ABC</td>
        <td>ABC</td>
      </tr>
      <tr>
        <td>Item 1</td>
        <td>Item 1</td>
        <td>
          <table border="1" style="width: 100%;">
            <tr>
              <td>Name 1</td>
              <td>Price 1</td>
            </tr>
            <tr>
              <td>Name 2</td>
              <td>Price 2</td>
            </tr>
            <tr>
              <td>Name 3</td>
              <td>Price 3</td>
            </tr>
          </table>
        </td>
        <td>Item 1</td>
      </tr>
      <tr>
        <td>Item 2</td>
        <td>Item 2</td>
        <td>Item 2</td>
        <td>Item 2</td>
      </tr>
      <tr>
        <td>Item 3</td>
        <td>Item 3</td>
        <td>Item 3</td>
        <td>Item 3</td>
      </tr>
    </table>

    0 讨论(0)
  • 2020-12-01 02:59

    Try this code

    <table border="1" width="100%">
      <tr>
        <td>Name 1</td>
        <td>Name 2</td>
        <td colspan="2">Name 3</td>
        <td>Name 4</td>
      </tr>
    
      <tr>
        <td rowspan="3">ITEM 1</td>
        <td rowspan="3">ITEM 2</td>
        <td>name</td>
        <td>price</td>
        <td rowspan="3">ITEM 4</td>
      </tr>
      <tr>
        <td>name</td>
        <td>price</td>
      </tr>
      <tr>
        <td>name</td>
        <td>price</td>
      </tr>
    </table>

    0 讨论(0)
  • 2020-12-01 03:02

    <table border="1px;" width="100%">
      <tr align="center">
        <td>Product</td>
        <td>quantity</td>
        <td>Price</td>
        <td>Totall</td>
      </tr>
      <tr align="center">
        <td>Item-1</td>
        <td>Item-1</td>
        <td>
          <table border="1px;" width="100%">
            <tr align="center">
              <td>Name1</td>
              <td>Price1</td>
            </tr>
            <tr align="center">
              <td>Name2</td>
              <td>Price2</td>
            </tr>
            <tr align="center">
              <td>Name3</td>
              <td>Price3</td>
            </tr>
            <tr>
              <td>Name4</td>
              <td>Price4</td>
            </tr>
          </table>
        </td>
        <td>Item-1</td>
      </tr>
      <tr align="center">
        <td>Item-2</td>
        <td>Item-2</td>
        <td>Item-2</td>
        <td>Item-2</td>
      </tr>
      <tr align="center">
        <td>Item-3</td>
        <td>Item-3</td>
        <td>Item-3</td>
        <td>Item-3</td>
      </tr>
    </table>

    0 讨论(0)
  • 2020-12-01 03:03

    Just add a new table in the td you want. Example: http://jsfiddle.net/AbE3Q/

    <table border="1">
      <tr>
        <td>ABC</td>
        <td>ABC</td>
        <td>ABC</td>
        <td>ABC</td>
      </tr>
      <tr>
        <td>Item1</td>
        <td>Item2</td>
        <td>
          <table border="1">
            <tr>
              <td>qweqwewe</td>
              <td>qweqwewe</td>
            </tr>
            <tr>
              <td>qweqwewe</td>
              <td>qweqwewe</td>
            </tr>
            <tr>
              <td>qweqwewe</td>
              <td>qweqwewe</td>
            </tr>
          </table>
        </td>
        <td>Item3</td>
      </tr>
      <tr>
      </tr>
      <tr>
      </tr>
      <tr>
      </tr>
      <tr>
      </tr>
    </table>

    0 讨论(0)
  • 2020-12-01 03:04

    Put another table inside the td element like this.

    <table>
        <tr>
            ...
        </tr>
        <tr>
            <td>ABC</td>
            <td>ABC</td>
            <td>
                <table>
                    <tr>
                        <td>name1</td>
                        <td>price1</td>
                    </tr>
    ...
                </table>
            </td>
            <td>ABC</td>
        </tr>
    ...
    </table>
    
    0 讨论(0)
提交回复
热议问题