Tag <colgroup> da HTML

  • 上一页
  • 下一页

Definition and Usage

The tag is used to specify the format of groups containing one or more columns in a table.

If you want to apply styles to all columns The tag is very useful, so you don't have to apply styles to each cell and each row repeatedly.

Note: The tag must be <table> child elements of the element, located at any <caption> after the element and any <thead>,<tbody>,<tfoot> and before the element.

Tip:If you need to apply To define different properties for a specific column, please Used in tags <col> tag

For more information, see:

HTML Reference Manual:<col> tag

HTML DOM Reference Manual:ColumnGroup object

Iyalan

A gina <colgroup> da <col> tag doni gina rami na bayiwa kaiwa:

<table>
  
    <col span="2" style="background-color:red">
    <col style="background-color:yellow">
  
  
    书号
    标题
    价格
  
  
    3476896
    HTML 入门
    $53
  

亲自试一试

属性

属性 描述
span 数字 规定列组应跨越的列数。

全局属性

标签还支持 HTML 中的全局属性

事件属性

标签还支持 HTML 中的事件属性

默认的 CSS 设置

大多数浏览器将使用以下默认值显示 元素:

colgroup {
  display: table-column-group;
}

亲自试一试

浏览器支持

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
支持 支持 支持 支持 支持
  • 上一页
  • 下一页