CSS shorthand

Is there a shorthand way to represent this in css:

.entry h1, .entry h2, .entry h3, .entry h4, .entry h5, .entry h6 {property:value}

ideally, it would be something along the lines:

.entry h1-h6 {property:value}


.entry [h1,h2,h3,h4,h5,h6] {property:value}

Basically no

.entry { }

will select all child elements.

No there isn’t I’m afraid and it looks like you want something like less css.

You can often shorten code by using an extra class instead but then you have to add it in the html so the benefits are lost.

Thanks for the top on “less css” Paul. Have you used it by chance? If so, I’d be interested in your thoughts…

I probably wouldn’t use it, since it relies on javascript, and if javascript is disabled, what will there be to fall back on?

Interesting concept, though.

If you use it serverside then it doesn’t rely on client side javascript as it is compiled before the client sees it. You could however use it just as a development tool only and then when finished compile it into the actual css file.

I haven’t used it myself but Remon (ScallioXTX) has played around with lessphp and says it could be useful so may be worth asking him when he’s back from holiday.

I can see how it would be useful but I don’t seem to have trouble doing it the old fashioned way anyway (copy and paste search and replace etc).:slight_smile:

There was an article on Sitepoint a while ago also.