如何为表格设置水平表头?

tables in html can have horizontal header and vertical header. for the horizontal header, we need to set all

inside a single  tag.

如何为表格设置水平表头?

语法

以下是设置表格水平标题的语法:

    horizontal header1…     horizontal header2… 

Example 1

的中文翻译为:

示例 1

Now let us see an example program to set horizontal header for a table.

                  table,tr,th,td {         border:1px solid black;         padding: 20px;      }      

Tables in HTML

First Name Job role

On executing the above program, it will display a table with horizontal headers First Name and Job role.

Example 2

现在,在这个第二个示例中,我们尝试创建另一个具有水平标题“Name”、“Age”和“Technology”的3行示例 −

         table, th, td {         border: 1px solid black;         width: 100px;         height: 50px;      }      

Employee Details

Name Age Technology
Amit 27 Database
Sachin 34 Marketing

Following is the output for the above example program.

Example 3

我们还可以为表格设置垂直标题。下面是一个示例,用于创建表格的垂直标题。

                  table,tr,th,td {         border:1px solid black;         padding: 20px;      }      
First Name
Last Name
Job role

Following is the output for the above example program.

以上就是如何为表格设置水平表头?的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1551464.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2025年12月21日 21:44:44
下一篇 2025年12月21日 21:45:08

发表回复

登录后才能评论
关注微信