Skip to content Skip to sidebar Skip to footer

Is There A Tag For Grouping "td" Or "th" Tags?

Does a tag for grouping th or td elements exist? I need something like this:

Solution 1:

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

<table><caption>Test Caption </caption><tr><thcolspan="2">65</th><thcolspan="2">40</th><thcolspan="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)

Solution 2:

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.

Post a Comment for "Is There A Tag For Grouping "td" Or "th" Tags?"