Looks like this might become possible soon: http://coding.smashingmagazine.com/2...ctors-level-4/
I like my solutions better though, but that's just me.
According to this article: http://css-tricks.com/efficiently-rendering-css/ browsers interpret CSS selectors from right to left, which should mean that it's not a top to bottom language. Is that true? If it is, then I see no problem to implement the above
Don't miss my point. I agree with you and think some things would be better added to CSS. But the way I see CSS it isn't meant (or wasn't intended) to do such things, even things as it does now. And no your suggestion wouldn't turn CSS into a "beast language" but where does it stop? If everyone had an idea about an addition to CSS and it got implemented, CSS would need a college course to learn.
And by a top to bottom language I mean in structure, not in application. The design of the language is a top to bottom design, unlike PHP and JS which look at any relevance for the class. Example: IF (a big IF) PHP were to do styling, say something simple like add a black border to each reference of $border_me, and in your top delegations you had $border_me == black; then 40 other lines of variable declarations, and then the 41st line was $border_me == red; PHP would most likely put two borders on the call, one red and one black. Although we may not see them both, they would both be there. Because PHP doesn't care. Where as CSS would only put the red one, because its declaration came after the black one and superseded it.
Your proposal, while a good one, goes against the way CSS operates and would make it very confusing.
That's all I am saying. If it is implemented, I would use it, for sure.
Of course I'm not the first one to talk about this, here are two articles I just found that deal with the same issue:
Because jQuery is not meant for styling, CSS is. Maybe my suggestions aren't the best, but I definitely don't think they make CSS a "beast language" that is hard to learn and use. Besides, have you seen CSS3?
Regarding CSS3 being top to bottom, how does the :empty pseudo-class work? I have no idea, but I'm guessing it finds the element, then goes "down" to see if it's empty, and selects it if it is. If that's how it works, then it should be possible to find an anchor link for instance, then go "down" to see if it contains an image, and then selects it if it does contain an image. That would makes so many things much easier to accomplish.
I understand what you are saying, but that is my point. We already have languages that do all that (like jQuery, etc.) so why make a simple language that is useful, easy to learn and easy to use, and turn it into a beast language like JS or C#?
Let the complicated languages be complicated and the simple ones be simple.
I did have a disclaimer in mind saying that I'm aware that this might not be possible but left it out, mostly because of the pseudo selector :contains() which worked (well works, but it's deprecated in CSS3) in a similar way as I would want my suggestions, although it didn't look for children, but for text. What I want is something like the jQuery :has().
Regarding your simple answer, it's that always the case that you can change the markup to fit your CSS. One example that I always bump into is <a href="#"><img src="#"></a>. Wouldn't it be awesome if you could do img < a? Or maybe li.current ^ div.nav? Or a:hover - a?
Just look at what you can do with CSS3, I'm sure CSS wasn't designed to do animations. If I could make an unqualified guess, I think this might make it into CSS4. I just wish I had it now!
<a href="#"><img src="#"></a>
img < a
li.current ^ div.nav
a:hover - a
Great read and I like your selections. the only problem here is you are forgetting what CSS means. "Cascading" from top to bottom.
The simple answer here is if you want Foo then use Foo. If you want to relate Foo to Bar, put Foo after Bar.
CSS was designed to be a top to bottom language, not a bottom to top or any other direction. Don't ask too much of a great, simple, language!
Can you do with naked markup what you can do with css?
All lights off, not computer.
Hmm no computer for 1 hour? I guess I could sleep...
Heheh, well even though everyone only talks about switching off the lights, I believe that this includes turning off the TV, the computer, the radio, etc. Here in Sweden for example, during Earth Hour, most radio and TV channels will stop broadcasting and many websites will be down or closed (or at least dark like Google). I would say the goal is to use a little energy as possible during Earth Hour.
Good reminder. The funny thing is, most of the time at night I only have two lights in my room turned on around the house anyway, so it's going to be very easy for me to participate in Earth Hour.