因为某些原因,需要在不修改 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>
|  |      1Biwood      2015-11-05 14:00:12 +08:00  1 #a a>font[color='red'] { dispaly:none; } | 
|  |      2acthtml      2015-11-05 14:01:08 +08:00 font{text-indent:-999999em;} | 
|  |      3rokeyzki      2015-11-05 14:02:48 +08:00  1 #a a>font[color='red'] {visibility:hidden; } 楼下继续 | 
|  |      4arnofeng      2015-11-05 14:03:20 +08:00 via Android  1 #a>p> a>font[color='red'] { dispaly:none; } | 
|  |      5kokdemo      2015-11-05 14:07:57 +08:00  1 #a>p> a>font[color='red'] { opacity:0; } | 
|  |      6FFLY OP | 
|  |      7bzw875      2015-11-05 14:09:22 +08:00 #a>p>a>font { color: transparent; } #a>p>a>font { color: #fff; } | 
|  |      9Biwood      2015-11-05 14:18:18 +08:00 @FFLY 可以用 CSS3 里面的 :first-child 或 :nth-child(n) 选择器,只能兼容到 IE9 ,这样写 #a>p:first-child>a:first-child>font[color='red']:first-child { display:none; } 过这样太难看了,而且前提是你的这个 DOM 结构不会动态修改 | 
|  |      11FFLY OP | 
|  |      12Biwood      2015-11-05 14:42:10 +08:00 @FFLY 强烈不建议这样写,这太奇怪了,谁知道你这个 onclick 里面的内容会不会修改,不要让表现层的东西对行为层产生依赖。最正规的方法是加一个类名到 a 标签上去,其他写法的都不稳定。 | 
|  |      15hupeng      2015-11-05 22:02:03 +08:00 { line-height:9999px;height:30px;overflow:hidden;} |