因为某些原因,需要在不修改 HTML 代码的情况下,隐藏 lang_01 ,但是一直没有找到好的方法。
<div id="a">
<p>
<a href="javascript:;" onclick="showWindow('b', 'c.php?id=d:e&f;123456789')">
<font color="red">lang_01</font>
</a>
</p>
</div>
因为某些原因,需要在不修改 HTML 代码的情况下,隐藏 lang_01 ,但是一直没有找到好的方法。
<div id="a">
<p>
<a href="javascript:;" onclick="showWindow('b', 'c.php?id=d:e&f;123456789')">
<font color="red">lang_01</font>
</a>
</p>
</div>
|
1
#a a>font[color='red'] { dispaly:none; }
|
|
acthtmlNov 5, 2015
2
font{text-indent:-999999em;}
|
|
3
#a a>font[color='red'] {visibility:hidden; }
楼下继续 |
|
4
#a>p> a>font[color='red'] { dispaly:none; }
|
|
5
#a>p> a>font[color='red'] { opacity:0; }
|
|
6
|
|
bzw875Nov 5, 2015
7
#a>p>a>font { color: transparent; }
#a>p>a>font { color: #fff; } |
|
BiwoodNov 5, 2015
9
@FFLY 可以用 CSS3 里面的 :first-child 或 :nth-child(n) 选择器,只能兼容到 IE9 ,这样写
#a>p:first-child>a:first-child>font[color='red']:first-child { display:none; } 过这样太难看了,而且前提是你的这个 DOM 结构不会动态修改 |
|
11
|
|
BiwoodNov 5, 2015
12
@FFLY 强烈不建议这样写,这太奇怪了,谁知道你这个 onclick 里面的内容会不会修改,不要让表现层的东西对行为层产生依赖。最正规的方法是加一个类名到 a 标签上去,其他写法的都不稳定。
|
|
hupengNov 5, 2015
15
{ line-height:9999px;height:30px;overflow:hidden;}
|