0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…
Defines properties for a single column or a span of columns within a colgroup. Use it to set column widths, apply background colors, or highlight specific columns in a table.
Description
The <col> element is a void element that lives inside a <colgroup>. It represents one or more columns in the table and allows you to apply a few styles (background, width, border, visibility: collapse) to all cells in those columns without repeating attributes on each cell.
You may write <col> elements directly after the caption without a <colgroup> tag: the parser creates the colgroup for you (its start and end tags are optional). A <colgroup> either has <col> children or a spanattribute, never both — when <col> children are present, the group's span is ignored.
The most common uses are setting consistent column widths and applying background colors to entire columns for visual grouping or emphasis.
When to Use
Fixed column widths: set specific widths for columns that should not auto-size
Proportional sizing: define percentage-based widths for responsive tables
Column highlighting: apply background colors to draw attention to specific columns
Spanning multiple columns: use span to apply the same properties to several consecutive columns
Examples
This demo shows alternating column backgrounds applied through individual <col> elements, creating a striped column effect that helps users track data vertically.
Col elements with background highlighting
1234567891011121314151617181920212223
<table><caption>Team Schedule</caption><colgroup><col /><colclass="tinted" /><col /><colclass="tinted" /></colgroup><thead><tr><thscope="col">Name</th><thscope="col">Monday</th><thscope="col">Tuesday</th><thscope="col">Wednesday</th></tr></thead><tbody><tr><td>Alice</td><td>9am-5pm</td><td>Remote</td><td>9am-5pm</td></tr><!-- More rows... --></tbody></table>
Column tint class
col.tinted {background: oklch(from var(--color-interactive) l c h / 0.08);}
The span Attribute
The spanattribute applies the same properties to multiple consecutive columns from a single <col> element, avoiding repetition.
Col with span attribute
123456
<colgroup><colclass="name-col" /><colspan="4"class="day-col" /></colgroup><!-- First col covers 1 column at 25% width, second col covers 4 columns each at 18.75% -->
Apply a subtle background to draw attention to a specific column, such as a recommended option in a comparison table. Derive the tint from a theme token so it works in dark mode and every theme.
Token-relative column tint
col.recommended {background: oklch(from var(--color-success) l c h / 0.15);}
Highlighting a single column
1234567
<colgroup><col /><col /><colclass="recommended" /><col /></colgroup><!-- Third column highlighted -->
Painting order
Column backgrounds sit at the bottom of the table's painting layers: table, column groups, columns, row groups, rows, then cells. VB gives every <th> a raised background and tbody tr:hover, .striped, data-selected and data-highlight paint row backgrounds, so all of these cover the column tint. Expect the tint to show only on plain <td> cells.
Styling Limitations
The CSS specification restricts which properties work on <col> elements.
Not supported:padding, text-align, color, font properties
For unsupported properties, target cells directly with CSS selectors, or use VB's data-numeric (right-aligned numbers) and data-align attributes on the <th>/<td> cells. data-align has no effect on <col>.
Targeting cells when col properties are limited
123456789101112
/* When col doesn't support the property you need, target cells directly: */td:nth-child(3),th:nth-child(3) {text-align: end;font-weight: bold;}/* Or use VB's data-numeric attribute for right-aligned numeric columns: *//* <th data-numeric>Amount</th> <td data-numeric>$1,234.56</td> */
Accessibility
Presentational element:<col> is primarily for styling and does not convey semantic meaning to assistive technologies
Header associations: proper column semantics come from <th scope="col">, not from <col>
Color contrast: when using background colors, ensure text remains readable with sufficient contrast