📌  相关文章
📜  区分<th>&<thead> HTML表格中的标签

📅  最后修改于: 2022-05-13 01:56:27.200000             🧑  作者: Mango

区分 HTML 表格中的 和 标记

在本文中,我们将区分 HTML 中使用的标记和标记。在继续之前,我们必须知道这两个标签都用于给出 HTML 表格中的标题。 标签用于给出 HTML 表格单元格中的标题,而 标签用于给出一组表格的标题。

注意:两个标签不能相互替换,您也不会看到输出的任何变化,因为只有开发人员或浏览器才能理解差异。

HTML 标签:此标签定义表格单元格的标题。默认情况下,表格中单元格的标题始终居中对齐,并且为粗体,以便任何人都可以轻松找到列的标题。它与每个 标记直接相关。基本上,HTML 中的表格由两个单元格组成,即标题单元格和数据单元格。

语法:在给定的语法中,3 列即 S.No、Book 和 Author 是单元格表的标题。


    S.No
    Name
    Roll NO

属性:

  • abb:指定标签的缩写。
  • colspan:定义没有。的列跨越一列。
  • 范围:指定表头单元格的范围。
  • 行跨度: 定义没有。行跨越一列。

示例:下面给出的示例演示了 标签的执行

HTML


  

    Page Title

  

    

GeeksforGeeks

    

The th tag

                                                                                                                                                                                       
S.NoBookAuthor
1Intro to C++E Bala.
2Programming FundamentalsGFG
  


HTML


  

    Page Title

  

    

GeeksforGeeks

    

The thead tag

                                                  Page Title                                  

GeeksforGeeks

            

The thead tag

               
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
S.NoBookAuthor
1Intro to C++E Bala.
2Programming FundamentalsGFG
                                                           S.No                 Book                 Author                                                             1                 Intro to C++                 E Bala.                                                             2                 Programming Fundamentals                 GFG                              


输出:

HTML 标签:这个标签帮助浏览器/搜索引擎找到表格主体的哪一部分是标题。此标签适用于 和 。为了在表格中使用此标签, 中必须有一个 标签。当需要打印包含各种页面的更大表格时,此标记也很有效,因为它有助于使表格的页眉和页脚打印在页面的顶部和底部。

句法:


    
        S.No
        Book
        Author
    

属性:

  • 对齐: 指定 HTML 页面中文本的对齐方式。
  • 对齐: 指定 HTML 文本的垂直对齐方式。
  • 字符: 将 元素内的内容对齐方式设置为字符。

示例:下面给出的示例演示了 标签的执行

HTML



  

    Page Title

  

    

GeeksforGeeks

    

The thead tag

                                                  Page Title                                  

GeeksforGeeks

            

The thead tag

               
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
S.NoBookAuthor
1Intro to C++E Bala.
2Programming FundamentalsGFG
                                                           S.No                 Book                 Author                                                             1                 Intro to C++                 E Bala.                                                             2                 Programming Fundamentals                 GFG                              

输出:

和 标签的区别:

It is a type of inline-block element.It is a type of block-level element.
It enables the users to render header and data cells distinctly.It enables the user to support independent scrolling of the head and foot of a table.
It defines the header of the cell.It defines the header of a group table.
The header is visible to the users in bold.The header isn’t visible to the users.
It is a column header.It is a table header.
The output can be seen in the table itself.The output is not seen by the users but only works for the browsers.
It affects the layout of the table.It does not affect the layout.
It specifies the vertical headers at the beginning or at end of every row.It specifies the horizontal header with full width.