表垂直头? [英] Table vertical header?

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

问题描述

如何使表格标题作为列显示在表格的左侧,而不是作为行显示在顶部?我有这个标记:

How can I make the table header appear on the left side of the table as a column instead on the top as a row? I have this markup:

<table>
  <thead>
    <tr>
      <th>a</th>
      <th>b</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>1</td>
      <td>2</td>
    </tr>
  </tbody>
</table>


推荐答案

如何?

thead {
  float: left;   
}

thead th {
  display: block;   
}

tbody {
  float: right;   
}

jsFiddle


好吧,1,2也应该是列,显然。

Well, the 1, 2 should also be as column, obviously.

jsFiddle

它看起来像IE baulks。您可能必须交换语义以实现跨浏览器兼容性。

It also looks like IE baulks at this. You may have to trade semantic-ness for cross browser compatibility.

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

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