垂直和水平标题在表中? [英] Vertical and Horizontal Headers in a table ?

查看:134
本文介绍了垂直和水平标题在表中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取包含水平和垂直标头的表格?

How would i get a table with both horizontal and vertical headers?

例如

         header1 header2 header3 
header1    1        1      1
header2    2        2      2 
header3    3        3      3 


推荐答案

像@UlrichSchwarz说的,你可以使用< th> 而不是< td> 。使用范围,您可以使其更具语义描述性:

Like @UlrichSchwarz said, you can just use <th> instead of <td> in the first column. Using scope, you can make it more semantically descriptive:

jsfiddle



jsfiddle

<table>
    <tr>
        <th></th>
        <th scope="col">header1</th>
        <th scope="col">header2</th>
        <th scope="col">header3</th>
    </tr>
    <tr>
        <th scope="row">header 1</th>
        <td>1</td>
        <td>1</td>
        <td>1</td>
    </tr>
    <tr>
        <th scope="row">header 2</th>
        <td>2</td>
        <td>2</td>
        <td>2</td>
    </tr>
    <tr>
        <th scope="row">header 3</th>
        <td>3</td>
        <td>3</td>
        <td>3</td>
    </tr>
</table>

这篇关于垂直和水平标题在表中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆