可以说我有:CSS:没有(),选择并选择后代
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test for :not</title>
<link rel="stylesheet" type="text/css" href="Test.css" />
</head>
<body>
<div class="a">
<p class="para">This line should be green.</p>
</div>
<div class="a">
<p class="para">This line should also be green.</p>
<div class="ds">
<p class="para">This is another line that should be yellow</p>
</div>
</div>
</body>
</html>
我想要做的是选择所有带class =“对”的元素,但不包括那些有这些元素的后代有一个class =“ds”。我有这样的CSS:
.ds { color: grey; border-style:solid; border-width:5px;}
.para {color:yellow;}
.para:not(.ds .para) {color:green; border-style:solid; border-width:5px;} //not working
所以我想我只能有简单的选择是部分:不是(S),我不能有:没有(X×Y)。我使用铬(18.0.1025.162米)和firefox(10)。有任何想法吗?
注意:请不查询是一个更大的问题的一部分,我有一些代码(GWT)是选择元素的列表(例如带class =“段”)从DOM。然而,我发现一个错误,需要排除特定元素集的后代元素(例如class =“ds”)。
你能更具体吗?你是什么意思“不控制代码”?你能控制什么? – Jon 2012-04-19 12:10:51
这意味着我正在使用使用gwt的第三方库,我所寻找的是我可以应用于此特定调用的一种风格。 – Asim 2012-04-19 12:26:33
呃......打电话?什么呼叫? – Jon 2012-04-19 12:33:04