Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML <colgroup> tags


May 04, 2021 HTML Reference Manual


Table of contents


HTML sl;colgroup sgt; tags

The label is used to represent a group of table columns for HTML, defining a set of lists in the table.

The labels set the background color for the three columns in the table:

<table border="1">
<colgroup>
<col span="2" style="background-color:red">
<col style="background-color:yellow">
</colgroup>
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Price</th>
</tr>
<tr>
<td>3476896</td>
<td>My first HTML</td>
<td>$53</td>
</tr>
</table>

Try it out . . .

Browser support

HTML <colgroup> tags HTML <colgroup> tags HTML <colgroup> tags HTML <colgroup> tags HTML <colgroup> tags

All major browsers support the hashtag.


Label definition and instructions for use

The label is used to combine columns in a table to format them.

You can apply styles to the entire column without having to repeatedly style each cell or row by using the label.

Note: Labels can only be used within the element, after any one of the elements, in any one of the elements.

Tip: If you would like to define a different property for a column in the .


The difference between HTML 4.01 and HTML5

Most of the properties in HTML 4.01 are no longer supported in HTML5.


Property

属性 描述
align left
right
center
justify
char
HTML5 不支持。 规定在列组合中内容的水平对齐方式。
char character HTML5 不支持。 规定根据哪个字符来对齐列组中的内容。
charoff number HTML5 不支持。 规定第一个对齐字符的偏移量。
span number 规定列组应该横跨的列数。
valign top
middle
bottom
baseline
HTML5 不支持。 定义在列组合中内容的垂直对齐方式。
width pixels
%
relative_length
HTML5 不支持。 规定列组合的宽度。


Global properties

The label supports the global properties of HTML.


The event property

The tag supports the event properties of HTML.