- From: gerard <w3c@rathersimple.com>
- Date: Sun, 13 Jun 2004 00:22:04 -0700
- To: www-talk@w3.org
I'd like so suggest that an operator to reverse the matching order of
selectors could be a very useful thing.
Ex:
<div class="ColorBackground>
<img class="AlphaImage">
</div>
If one wanted to select any <div> that contained an image with class
"AlphaImage", there is no way to do so.
this situation (for me at the moment) is complicated by
"ColorBackground" being any of eight values, but I would like each of
those div classes to share common attributes.
the selector:
div img.thumb { }
will select the img tag for modification under current rules. There is
no way to universally select that div under CSS2.
I think an operator such as a leading "!"(exclamation mark) or "<"(less
than) should reverse the matching order such that the selector above
would match the most outside element instead of the most inner one.
Ex:
! div img.thumb { }
Placing the modifier at the start of the line seems the best choice to
me as the intent is clear from outset. I would suggest that this work
for all selector types, not just the simple inheritance case
demonstrated.
I write this because in the case I just wanted to use it for it would
save significant markup in the style sheet and be easier to read and
maintain than the alternatives. I was actually rather shocked that I
could not locate an existing mechanism to simply select a parent
instead of a child. With such a selector my page could perhaps be
Specifically in this case, I want to use the enclosing div's background
color setting to for the color behind a PNG image file with alpha
channel. There will be several colors available, and it would be
simpler to set all the other common attributes of the div via such a
selector than to set them all discreetly or by grouping. I'm certain
there are other more blase cases for such an operator, especially in
dynamically generated content.
------------------------------------------------------------------------
------------------------
No matter where you go... there you are.
Received on Sunday, 13 June 2004 03:23:37 UTC