当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


HTML <colgroup> char属性用法及代码示例


HTML <colgroup> char属性用于设置字符列组中内容的对齐方式。仅当align属性设置为“character”时,才可以使用它。字符的默认值是页面语言的decimal-point字符。

用法:

<colgroup char="character">

属性值:


  • character:它指定内容与字符的对齐方式。

例:

<!DOCTYPE html> 
<html> 
  
<head> 
    <title> 
        HTML ColumnGroup char Attribute 
    </title> 
  
    <style> 
        #myColGroup { 
            background:green; 
        } 
          
        table { 
            color:white; 
            margin-left:180px; 
            background:yellow; 
        } 
          
        #Geek_p { 
            color:green; 
            font-size:30px; 
        } 
          
        td { 
            padding:10px; 
        } 
          
        h1, 
        h2 { 
            text-align:center; 
        } 
    </style> 
</head> 
  
<body> 
  
    <h1 style="color:green;">  
        GeeksForGeeks  
    </h1> 
  
    <h2>  
        HTML ColumnGroup char Attribute  
    </h2> 
  
    <table> 
        <colgroup id="myColGroup" 
                  span="3" 
                  align="char" 
                  char="."> 
        </colgroup> 
  
        <tr> 
            <th>S.No</th> 
            <th>Title</th> 
            <th>Geek_id</th> 
        </tr> 
        <tr> 
            <td>Geek_1</td> 
            <td>GeekForGeeks</td> 
            <th>Geek_id_1</th> 
        </tr> 
        <tr> 
            <td>Geek_2</td> 
            <td>GeeksForGeeks</td> 
            <th>Geek_id_2</th> 
        </tr> 
    </table> 
</body> 
  
</html>

输出:



相关用法


注:本文由纯净天空筛选整理自ManasChhabra2大神的英文原创作品 HTML | <colgroup> char Attribute。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。