pub struct Col;Expand description
The <col> element - defines a column within a table.
§Purpose
The <col> element defines a column or a group of columns within a table. Used inside
<colgroup> to apply attributes and styles to entire columns without affecting individual
cells. Provides a way to style columns collectively.
§Content Categories
- None (only valid within
<colgroup>)
§Permitted Content Model
- None (void element)
§Common Use Cases
- Setting column widths
- Applying styles to specific columns
- Defining visibility for individual columns
- Grouping columns with shared formatting
- Creating alternating column styles
§Key Attributes
span: Number of consecutive columns this element represents (default: 1)
§Example
<!-- Individual column styling -->
<table>
<colgroup>
<col class="name-column">
<col class="data-column">
<col class="data-column">
</colgroup>
<thead>
<tr>
<th>Name</th>
<th>Value 1</th>
<th>Value 2</th>
</tr>
</thead>
</table>
<!-- Using span attribute -->
<table>
<colgroup>
<col>
<col span="2" class="numeric-columns">
<col>
</colgroup>
<thead>
<tr>
<th>Product</th>
<th>Price</th>
<th>Quantity</th>
<th>Notes</th>
</tr>
</thead>
</table>
<!-- Column widths -->
<table>
<colgroup>
<col style="width: 40%;">
<col style="width: 30%;">
<col style="width: 30%;">
</colgroup>
<thead>
<tr>
<th>Description</th>
<th>Category</th>
<th>Status</th>
</tr>
</thead>
</table>§WHATWG Specification
Trait Implementations§
Source§impl HtmlElement for Col
impl HtmlElement for Col
impl CanContain<Col> for Colgroup
Auto Trait Implementations§
impl Freeze for Col
impl RefUnwindSafe for Col
impl Send for Col
impl Sync for Col
impl Unpin for Col
impl UnwindSafe for Col
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more