html - 如何创建带有列和行部分标题的 html 表格

标签 html css html-table

我正在尝试制作一个与此类似的 html 表格:

enter image description here

我对表格的数据不感兴趣,只对准系统感兴趣:可能性、后果、列名称(次要、中等)和行(几乎确定、可能等)。

这是我目前所拥有的:http://jsfiddle.net/PQHR6/

我不知道如何制作那些LikelihoodConsequence header

最佳答案

您需要将 th 与属性 colspan 一起使用。

    <tr>
        <th>Table header</th>
        <th colspan="5">Table header</th>
    </tr>
    <tr>
        <th>&nbsp; <!-- EMPTY --></th>
        <th>Minor</th>
        <th>Lorem 1</th>
        <th>Lorem 2</th>
        <th>Lorem 3</th>
        <th>Lorem 4</th>
    </tr>
    <tr>
        <th>Almost Certain</th>
        <td>Table cell 1</td>
        <td>Table cell 2</td>
        <td>Table cell 3</td>
        <td>Table cell 4</td>
        <td>Table cell 5</td>
    </tr>

jsfiddle:http://jsfiddle.net/nPQfz/

关于html - 如何创建带有列和行部分标题的 html 表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14962836/

相关文章:

html - 在 SVG 中使用外部参数

html - 背景图像 CSS 不工作

html - css 如何将此内容居中

html - 我可以缩小谷歌字体吗?

html - 如何卡住表格的标题和左列

javascript - 格式化问题 : DropDown of checkboxes

javascript - 将 html 标签作为 ejs 变量的值传递

javascript - 如何使用 javascript 或 jquery 激活按钮?

javascript - 如何显示从 .val() 获取的值

php - 使用 jQuery 计算 keyup 的值