PHP前端开发

如何在HTML中包含表格列的组?

百变鹏仔 4周前 (09-21) #HTML
文章标签 表格

使用

标记包含表列组。HTML 标记用于指定表内一组列的属性。如果需要对 colgroup 中的列应用不同的属性,可以在 colgroup 标记中使用 HTML col 标记。

以下是属性 -

属性描述

立即学习“前端免费学习笔记(深入)”;

对齐

居中

对齐

char

定义水平对齐方式,Html5 不支持
字符字符定义用于对齐文本的字符(与align ="char"一起使用), Html5 不支持
查奥夫像素定义应跨越的列数,不支持Html5
跨度number定义 应跨越的列数,在 Html5 中不支持。
Valign底部

中间

顶部

基线

定义垂直对齐方式,Html5 不支持。
宽度像素或%指定当前列跨越的每列的默认宽度元素,在 Html5 中不受支持。

示例

您可以尝试运行以下代码来实现 HTML 中的

标签 -
<!DOCTYPE html><html>   <head>      <title>HTML col Tag</title>   </head>   <body>      <p>This example shows a colgroup that has three columns of different widths:</p>      <table border = "1">         <colgroup span = "4">            <col width = "40"></col>            <col width = "70"></col>            <col width = "100"></col>            <col width = "130"></col>            <col width = "160"></col>            </colgroup>         <tr>            <td>One</td>            <td>Two</td>            <td>Three</td>            <td>Four</td>            <td>Five</td>         </tr>      </table>   </body></html>