Is there a tag for grouping “td” or “th” tags?

前端 未结 2 1650
梦如初夏
梦如初夏 2021-01-24 02:31

Does a tag for grouping th or td elements exist?

I need something like this:

相关标签:
2条回答
  • 2021-01-24 02:51

    Does exists a tag for grouping th or td element?

    Yes, it's called colgroup.

    Don't want to use a colgroup? Sorry, that's how grouping table columns is done in HTML. Use the tools given to you, or don't.

    0 讨论(0)
  • 2021-01-24 03:08

    for grouping cols (or rows ) in a html table you can use colspan (or rowspan) attribute

      <table> 
          <caption>Test Caption </caption> 
          <tr> <th colspan="2">65</th> 
            <th colspan="2">40</th> 
            <th colspan="2">20</th> 
          </tr> 
          <tr> 
            <th>Men</th> 
            <th>Women</th> 
            <th>Men</th> 
            <th>Women</th> 
            <th>Men</th> 
            <th>Women</th> 
          </tr> 
          <tr> 
            <td>82</td> 
            <td>85</td> 
            <td>78</td> 
            <td>82</td> 
            <td>77</td> 
            <td>81</td> 
          </tr>
      </table>
    

    (or nested table)

    0 讨论(0)
提交回复
热议问题