HTML Colgroup Tag - Dofactory
Có thể bạn quan tâm
The <colgroup> tag serves as a container for <col> elements.
It is used to style one or more columns for all table rows.
The <colgroup> can have zero, one, or more <col> elements.
Example
#
A <colgroup> with two <col> elements that specify the background colors.
Id | First Name | Last Name | Country |
---|---|---|---|
ART-303 | Vincent | Van Gogh | Netherlands |
ART-877 | Paul | Cézanne | France |
Using <colgroup>
#
The <colgroup> tag is a container for <col> tags.
It can hold zero, one, or more <col> elements.
This tag must be located before other table elements like <thead>, <th>, and <td>.
HTML <col> HTML <data>Attributes for <colgroup>
#
This table lists the <colgroup> tag attributes.
Attribute | Value | Description |
---|---|---|
span | number | Number of columns a <colgroup> should span |
id | identifier | Defines a unique identifier for the colgroup. |
For addional global attributes see our global attributes list.
Obsolete Attributes
Do not use the attributes listed below. They are no longer valid on colgroup tag in HTML5.
Attribute | Description | Alternative |
---|---|---|
align | Aligns the content in each column cell. | CSS text-align |
bgcolor | Defines the background color for each column cell. | CSS background-color |
char | Aligns content to a character, for example "," or ".". | CSS text-align |
charoff | Shifts column data to the right relative to char attribute. | CSS text-align |
valign | Sets the vertical alignment of content in each column cell. | CSS vertical-align |
Table Tags
#
The <colgroup> tag is part of a group of tags that are used to create HTML tables. This group is referred to as the Table tag group. Together, they allow you to create comprehensive HTML tables. A list of table tags
Element | Description |
---|---|
<table> | Creates a table that contains elements listed below |
<caption> | Creates a caption above or under a table |
<colgroup> | Creates a container for col elements |
<col> | Creates a style for one or more columns in a table |
<thead> | Creates a table header that can style all header cells |
<tbody> | Creates a table body that can style all data cells |
<tfoot> | Creates table footer that can style all footer cells |
<tr> | Creates a table row that contains table cells |
<th> | Creates a table header cell |
<td> | Creates a table data cell |
Browser support
#
Here is when <colgroup> support started for each browser:
Chrome | 1.0 | Sep 2008 |
Firefox | 1.0 | Sep 2002 |
IE/Edge | 1.0 | Aug 1995 |
Opera | 1.0 | Jan 2006 |
Safari | 1.0 | Jan 2003 |
You may also like
#
- Our HTML col Tag Reference
- Our HTML Tables Tutorial
- Our CSS Tables Tutorial
Từ khóa » Html Colgroup Background Color
-
HTML Colgroup Tag - W3Schools
-
HTML Table Colgroup - W3Schools
-
Colgroup Background Color Not Override Tr Background Color
-
HTML:
Tag - TechOnTheNet -
: The Table Column Group Element - MDN Web Docs -
HTML |
Bgcolor Attribute - GeeksforGeeks -
HTML Colgroup Tag - Web4College
-
HTML Col, Colgroup Tutorial With Examples - O7planning
-
Set Background For Column Group In HTML And CSS
-
HTML
Tag - W3docs -
HTML Table Colgroup - ForgeGeek
-
What Is Colgroup Tag In HTML?
-
HTML - Colgroup Tag - Tutorialspoint
-
HTML Colgroup Tag | How To Specify Table Background Style?