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

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

问题描述

如何获得同时包含水平和垂直标题的表?

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:

<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天全站免登陆