Table Colgroup Span Column Styling

Apply column level styling and spanning using colgroup and col elements for efficient table layout control.

HtmlData Fetching

Code

snippet
<table>
  <colgroup>
    <col style="width: 200px; background: #f0f0f0;" />
    <col span="2" style="text-align: right;" />
    <col style="width: 100px;" />
  </colgroup>
  <thead>
    <tr><th>Name</th><th>Price</th><th>Qty</th><th>Total</th></tr>
  </thead>
  <tbody>
    <tr><td>Widget</td><td>$10</td><td>5</td><td>$50</td></tr>
    <tr><td>Gadget</td><td>$25</td><td>3</td><td>$75</td></tr>
  </tbody>
</table>