Re: Proposal for new `any of these elements' selector type

fantasai wrote:
> Matthew Thomas wrote:
> >
> > The cause of the problem is that instead of just selecting on UL, we're
> > selecting on UL or OL or DIR or MENU. And while CSS allows selecting on
> > one element (NameOfElementHere) or all elements (*), it does not allow
> > selecting on a particular subset of elements.
> >
> > So, I thought, why not introduce `any of these elements' syntax into
> > CSS? Then all the above html.css code could be replaced with only three
lines:
> > |
> > |                                   ul {list-style-type: disc;}
> > |                  (ul,ol,menu,dir) ul {list-style-type: circle;}
> > | (ul,ol,menu,dir) (ul,ol,menu,dir) ul {list-style-type: square;}
> >
> > Discuss amongst yourselves. :-)
>
> This can be done with the :matches() proposal -
>
>                                                   ul {list-style-type:
disc;}
>                          :matches(ul,ol,menu,dir) ul {list-style-type:
circle;}
> :matches(ul,ol,menu,dir) :matches(ul,ol,menu,dir) ul {list-style-type:
square;}

Actually, it can be done using the :not() pseudo-class:

ul {list-style-type: disc;}
:not(:not(ul):not(ol):not(menu):not(dir)) ul {list-style-type: circle;}
:not(:not(ul):not(ol):not(menu):not(dir))
:not(:not(ul):not(ol):not(menu):not(dir)) ul {list-style-type: square;}

It's not very pretty though...

/ Jonas Sicking

Received on Wednesday, 2 January 2002 16:16:42 UTC