CSS |空单元格属性

原文:https://www.geeksforgeeks.org/css-empty-cells-property/

此属性用于指定是否在表格的空单元格中显示边框。

语法:

empty-cells: show|hide|initial|inherit;

默认值:

  • 显示

属性值:

显示属性:该属性用于显示空单元格的边框。

  • 语法:

    html empty-cell: show;

  • Example:

    Hypertext Markup Language

    ```html <!DOCTYPE html>     

            empty-cell property                      table.geek {                 empty-cells: show;             }             td {                 text-align:center;             }             .gfg {                 font-size:40px;                 font-weight:bold;                 color:green;             }             .geeks {                 font-size:17px;             }                            
                
    GeeksforGeeks
                
    A computer science             portal for geeks

    empty-cells: show;

                                                                                                                                                     
    C ProgrammingC++ Programming
    Java
            
                              ```
  • 输出: image

隐藏属性:该属性用于隐藏表格中空单元格的边框。

  • 语法:

    html empty-cell: hide;

  • Example:

    Hypertext Markup Language

    ```html <!DOCTYPE html>     

            empty-cell property                      table.geek {                 empty-cells: hide;             }             td {                 text-align:center;             }             .gfg {                 font-size:40px;                 font-weight:bold;                 color:green;             }             .geeks {                 font-size:17px;             }                            
                
    GeeksforGeeks
                
    A computer science             portal for geeks

    empty-cells: show;

                                                                                                                                                     
    C ProgrammingC++ Programming
    Java
            
                              ```
  • 输出: image

初始属性:该属性用于设置默认属性。

  • 语法:

    html empty-cell: initial;

  • Example:

    Hypertext Markup Language

    ```html <!DOCTYPE html>     

            empty-cell property                      table.geek {                 empty-cells: initial;             }             td {                 text-align:center;             }             .gfg {                 font-size:40px;                 font-weight:bold;                 color:green;             }             .geeks {                 font-size:17px;             }                            
                
    GeeksforGeeks
                
    A computer science             portal for geeks

    empty-cells: show;

                                                                                                                                                     
    C ProgrammingC++ Programming
    Java
            
                              ```
  • 输出: image

继承属性:此属性用于从其父级继承属性。

  • 语法:

    html empty-cell: inherit;

  • Example:

    Hypertext Markup Language

    ```html <!DOCTYPE html>     

            empty-cell property                      table.geek {                 empty-cells: initial;             }             .g4g {                 empty-cells: inherit;             }             td {                 text-align:center;             }             .gfg {                 font-size:40px;                 font-weight:bold;                 color:green;             }             .geeks {                 font-size:17px;             }                            
                
    GeeksforGeeks
                
    A computer science             portal for geeks

    empty-cells: show;

                                                                                                                                                                                     
    C ProgrammingAlgorithm
                                                                                                                                                                                                                                                                                                             
    DPBacktracking
    Sorting
                        
            
                              ```
  • 输出: image inherit property

支持的浏览器:CSS |空单元格属性支持的浏览器如下:

  • 谷歌 Chrome 1.0
  • internet explorer 8.0
  • Firefox 1.0
  • Opera 4.0
  • Safari 1.2