通过CSS隐藏表的第一列的方法 [英] Ways to hide first column of table through CSS

查看:86
本文介绍了通过CSS隐藏表的第一列的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码正在使用IE以外的浏览器:

This code is working on browsers other than IE:

table.tbl.tr.td:first-child { display: none; }

我应该使用什么方法使其在所有浏览器上正常工作?

What shall I use for to make it work on all browsers?

推荐答案

不幸的是,旧版本的IE不支持:first-child in CSS。不知道IE8。无论如何,如果你不想做javascript,并且你有访问的html,很容易分配一个第一类到表中的第一列tds。所以html将如下所示:

Unfortunately, older versions of IE do not support :first-child in CSS. Don't know about IE8. Anyways, if you don't want to do javascript, and you have access to the html, it's pretty easy to assign a "first" class to the first column tds in the table. So the html will look like:

<table>
  <tr>
    <td class="first">...</td>
    <td>..</td>
    ..
  </tr>
</table>

然后,您可以创建一个css条目,如:

You can then create a css entry like:

table td.first { display: none; }

这篇关于通过CSS隐藏表的第一列的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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