html - 表格上方的标签

标签 html css

所以我有这个

echo   
"<div class=''>
 <table class='table' border='1'>
     <tr class='head'>

     <th>Section Name</th>
     <th></th>
     <th>Ae</th>
     <th>Pt</th>
     <th>Prin</th>

我怎样才能在它上面得到一个漂亮的标签,它看起来像是表格的一部分,但它位于 THs 上方的中间,我希望它代表表格名称,例如它会说。表 1 居中并位于该表上方,但仍在表的边框中。

最佳答案

我会插入一个 <caption> 开口之间的元素 <table>元素和第一个<tr>喜欢:

<table style="width: 100%">
    <caption>Table 1</caption>
    <tr>...

<caption>几乎是为此而生的:

The HTML <caption> Element (or HTML Table Caption Element) represents the title of a table.Though it is always the first descendant of a <table>, its styling, using CSS, may place it elsewhere, relative to the table.

关于html - 表格上方的标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35512470/

相关文章:

html - 简单的 z-index 挑战 : making a sibling disappear behind another sibling?

html - 在动画中调整 div 大小时变换原点问题

javascript - 隔离较少的样式以响应组件

android - 如何在android中将HTML文本更改为简单字符串

javascript - 具有元素结构概述的预加载器屏幕

jquery - 如何使用 jQuery 在 HTML 中显示对话框?

asp.net - 如何在 asp :textbox 中放置提示

html - 为什么这两个页面的列大小不同?

html - CSS:无法选择标题中的元素?

javascript - 如何在 Spring MVC 4 和 HTML5 应用程序上添加带有 JS 和 CSS 的导入文件?