Applying Column-Based Formatting
Column groups are handy for applying formatting to entire columns. For example, suppose you decide that all the text in the column farthest to the right should be italicized. You could do that by inserting italics tags in each cell, but that becomes a less-attractive option when there are hundreds of rows.
The <colgroup> tag can be used as either a one-sided or two-sided tag. As a one-sided tag, you can specify styles that will be applied to the current column and continue for a specified number of columns. For example, to apply a yellow background to the first column, create a column group immediately following the opening <table> tag:
<colgroup span="1" style="background-color: yellow" />
You can increase the span ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access