CSS:隐藏没有类或ID的表 [英] CSS: hide table with no class or id

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

问题描述

是否有一种方法可以通过使用表样式选择来隐藏没有类的特定表?

Is there a way to hide a particular table that does not have a class by using the table styling to select?

例如,如果我有一个以此名称命名的表

For example if I had a table with this name

<table border="0" cellspacing="0" cellpadding="0" width="300" height="100">

<td colspan="3">

我无权访问html并且不能使用javascript,必须是CSS解决方案.

I do not have access to the html and cannot use javascript, must be a css solution.

推荐答案

如果您愿意牺牲IE 6的兼容性,则可以基于属性使用

If you're willing to sacrifice IE 6 compatibility, you can to it based on attributes with the attribute selector. For example:

td[colspan="2"] {color: red}
table[border="0"][cellspacing="0"][cellpadding="0"][width="300"][height="100"] {text-align: center}

否则,您可以尝试根据上下文选择表(例如div.container div.innercontainer table).

Otherwise, you could try to select the table based on the context (e.g. div.container div.innercontainer table).

这篇关于CSS:隐藏没有类或ID的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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