RE: proposal for a new css combinator

>> It's not especially elegant, but gets the job done, I think.

 

Indeed, but as you stated already, it's not very elegant.

 

1/ when you change something to the focus header you have to reset it
for whatever components are nested

2/ when you nest a new component you have to reset all the styles again.

 

But even worse!

 

3/ what if the second heading can't be reset. Imagine the focus heading
has a padding of 1em. The second heading has a padding of 0.5em;
Depending on where all of this is placed in your css you have to do a
whole lot of rewriting and redefining the same values (for no good
reason really).

 

Imo, this is not really acceptable behaviour.  Probably okay and doable
10 years ago, but if you want to deliver quality work to your clients
you should be able to build more robust and flexible solutions, allowing
nestings that don't pick up any unneeded styles (especially handy when
building a framework where you don't even know what will be nested.

 

From: Brad Kemper [mailto:brad.kemper@gmail.com] 
Sent: 13 January 2010 15:36
To: Niels Matthijs
Cc: www-style list
Subject: Re: proposal for a new css combinator

 

 

On Jan 13, 2010, at 4:02 AM, Niels Matthijs wrote:





I'm quite sure that someone before me must've thought about this, or
maybe I just didn't look closely enough at the latest specs, but I
believe we are missing an important css combinator.

 

For the full explanation you can check the following article:
http://www.onderhond.com/blog/work/missing-css-combinator

 

I think in general, you could achieve your aims (including IE6
compatibility) with something like the following, right?

 

..focusBlock header { /* stying for first level of header in the focus
block */  }

..focusBlock header header { /* reset any styles you don't want in
subsequent header descendants  */  }

 

It's not especially elegant, but gets the job done, I think.

Received on Wednesday, 13 January 2010 15:30:25 UTC