I want to apply a attribute to all input[type=text] elements but exclude certain elements.
The elements to exclude does not have any class but their parent parent does.
The HTML looks like
<tr class="filters">
<td>
<input type="text" name="aName">
</td>
<td>
<input type="text" name="anotherName">
</td>
...
</tr>
I tried this CSS:
input[type=text]:not(tr.filters > td > input[type=text])
{
min-width:400px;
}
but it does not work.
Is it not possible to use not() in this way?
It’s not possible with
:not()as a CSS selector. The:not()pseudo-class accepts only a simple selector (which means exactly onetype,.class,#id,[attribute]or:pseudo-classselector). Combinators like,>and+aren’t allowed.The default value of
min-widthis zero, so you can simply use an overriding rule instead and set it to that: