Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

And that, my kids, is why CSS sucks. Cascading is the most stupid "feature" ever. Just imagine that we could've had classes with inheritance instead, which would reduce time spent on debugging the selector mess it is now; browsers would also parse the styles much faster. And then we could build modules or components, themes and frameworks on top of that. Add a semantic constraint engine with parametric styles (so I can say if I want two elements to align in some way), support for calculations, and coding CSS would be fun instead of frustrating. One can dream, I guess...

A much better rant on CSS general sulkiness: http://www.raizlabs.com/blog/2006/09/25/ten-reasons-why-css-...



Just because you don't like a feature or design choice doesn't mean that the entire language sucks. If used right, cascading can be incredible powerful. If used poorly, it's a total PITA.

You could make similar complaints about insert your favorite language/framework here.

If you want to make webpages, you're pretty much stuck with CSS for the foreseeable future. Better to promote best practice rather than writing off the entire language.


You are right. A single feature isn't a reason to think that an entire language sucks. But in this instance we are talking about a defining feature of the language. They're called cascading style sheets for a reason. I know we're stuck with it for now, that's why I'm ranting. My god, this is like PHP in the 90s, if I rant against something, then "I'm using it wrong" or "I'm too stupid and don't understand how great it is". And in the meantime all the CSS "gurus" are teaching people that to centre an element it is perfectly normal to write { left: 50%; width: 400; margin-left: -200px }. Even worse, they squabble over which way to clear floats is the correct one, when the truth is we shouldn't be having to do this in the first place.


The tech community should have a discussion about the best way to move forward with CSS, but it will probably turn into this: http://xkcd.com/927/

Like it or not, CSS has legacy support built into millions and millions of devices that cannot be easily updated. Newer versions can come forward, but more likely than not, the best thing to do would be to build on frameworks such as LESS (or one of it's cousins) that allows you to code in a meta language. Combine it with some static analysis tools and you can create a system that warns you when you cascade too much (for some value of too much) and help keep you sane.


I guess that is why the web is so great, despite of all the technical problems. There was a good post recently about OOCSS and SASS, I think it is a good approach for now.


For what it's worth, I have used CSS for years without knowing anything about specificity and never had to debug (more than a few seconds) anything related to specificity... If you actually have to use the formula to find out the specificity of a selector, I'd say there's likely something wrong with the way you code CSS.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: