HTML <colgroup> Tag
Example
The <colgroup> and <col> tags set the background color for three columns in a table:
| ISBN | Title | Price |
|---|---|---|
| 3476896 | My first HTML | $53 |
Browsers Support
All major browsers support the <colgroup> tag.
Tag Definition and Usage Notes
The <colgroup> tag is used to group columns in a table for formatting purposes.
Using the <colgroup> tag allows you to apply styles to an entire column without having to repeat the styling for each cell or row.
Note: The <colgroup> tag can only be used within the <table> element, after any <caption> element, and before any <thead>, <tbody>, <tfoot>, or <tr> elements.
Tip: If you want to define different properties for a specific column within the <colgroup>, use the <col> tag inside the <colgroup> tag.
Differences Between HTML 4.01 and HTML5
HTML5 no longer supports most attributes from HTML 4.01.
Attributes
| Attribute | Value | Description |
|---|---|---|
| align | left, right, center, justify, char | HTML5 does not support. Specifies the horizontal alignment of content in the column group. |
| char | character | HTML5 does not support. Specifies which character to align the content of the column group by. |
| charoff | number | HTML5 does not support. Specifies the offset of the first alignment character. |
| span | number | Specifies the number of columns that the column group should span. |
| valign | top, middle, bottom, baseline | HTML5 does not support. Defines the vertical alignment of content in the column group. |
| width | pixels, %, relative_length | HTML5 does not support. Specifies the width of the column group. |
Global Attributes
The <colgroup> tag supports HTML's global attributes.
Event Attributes
The <colgroup> tag supports HTML's event attributes.
Related Pages
Coding Plan
Supports mainstream large models such as Doubao, GLM, DeepSeek, Kimi, MiniMax, etc., official supply is stable and reliable.
Β₯9.9 / month
Immediately open
Xunfei Star Coding Plan
Includes free model call quota, DeepSeek, GLM, Kimi, MiniMax, one-stop experience and deployment platform.
Β₯3.9 / month
Immediately open
Share notes
Category Navigation
- Python / Data Science
- AI / Intelligent Development
- Frontend Development
- Backend Development
- Database
- Mobile Development
- DevOps / Engineering
- Programming Language
- Computer Basics
- XML / Web Service
- .NET
- Website Construction
Advertisement
- HTML Tag List (Alphabetical Order)
- HTML Tag List (Functional Order)
- HTML Global Attributes
- HTML Events
- HTML Canvas
- HTML Audio/Video
- HTML Valid DOCTYPES
- HTML Color Names
- HTML Picker/Color Picker
- HTML Color Mixing
- HTML Emoji
- HTML Character Sets
- HTML ASCII
- HTML ISO-8859-1
- HTML Symbols
- HTML URL Encoding
- HTML Language Codes
- HTML Country/Region Codes
- HTTP Messages
- HTTP Methods
- Px/Em Conversion Tool
- Keyboard Shortcuts
- HTML Tags
Online Examples
- HTML Examples
- CSS Examples
- JavaScript Examples
- Ajax Examples
- jQuery Examples
- XML Examples
- Java Examples
Character Set & Tools
- HTML Character Set Settings
- HTML ASCII Character Set
- JS Obfuscation/Encryption
- PNG/JPEG Image Compression
- HTML Color Picker
- JSON Formatting Tool
- Random Number Generator
Latest Updates
- Dart Enum and Symbol
- Dart Unit Testing
- Dart Concurrency and Iso...
- Dart Stream Flow
- Dart Asynchronous Programming
- Dart typedef and...
- Dart Package and Library Management
Site Information
- Feedback
- Disclaimer
- About Us
- Article Archive
Follow WeChat
YouTip