5 ms·
> My other big problem with CSS is the "inheritance" model. For one, it shouldn't be called inheritance. It should be called "cascading" because that's what it
by masklinn 16y ago
> My other big problem with CSS is the "inheritance" model. For one, it shouldn't be called inheritance. It should be called "cascading" because that's what it is.
Cascading already means something in CSS (hint: the C means "Cascading", that quite strongly suggest there is a concept of cascade in it). And I'd like to see what problem you have with CSS inheritance: if an element inherits a property, then it gets the same (computed) property as its parent. That seems pretty simple and straightforward, and a good match for the word "inheritance".
> Inheritance at the class level would actually be useful (and is another glaring omission).
What does that even mean? Do you mean mixins at the block level? Overriding rules? Classes are just a type of selectors in CSS, where would inheritance fit in anything? And if you can inherit classes (whatever that's supposed to mean) why couldn't you inherit ids, attribute selectors or pseudo-selectors?
- lwhi 16y agoExactly - I don't think it's fair to blame a spec when its lack of knowledge that's driving the criticism. EDIT: Thinking about it - maybe the author should have employed a front-end developer? There's a good reason people specifically work on this stuff ..
- mkn 16y agoThere's a good reason people specifically work on this stuff .. I don't get this at all. Central to the design of HTML and the Web is the notion of democratic access to information and the ability for non-specialists to create it. Furthermore, the motivation behind CSS was to make it easier to do this work by separating the design from the information. CSS should therefore be, if not intuitive, at least easy to learn, use, and troubleshoot. It's true, we need brain surgeons to do brain surgery, but we shouldn't need specialists to do basic things like vertical centering, convincing layout without tables, and overriding styles in nested elements. We've come a long way from the intent of CSS if we're arguing that only specialists should use it.
- lwhi 16y ago"Central to the design of HTML and the Web is the notion of democratic access to information and the ability for non-specialists to create it." I imagine the large majority of the hackernews readership can be defined as a 'web specialist' of one kind or another, so if this were true most of us would be out of a job :P My point is - there's no good reason why front-end development should be any less complicated than back-end development. Just because people expect it to be easy, isn't a good enough reason ..
- danenania 16y agoEven the most complex layouts are conceptually much simpler than any non-trivial business logic. You can test this by trying to explain both aspects of a project you're working on to a non-technical friend and see which he or she is better able to grasp. It's important to distinguish whether a task is made complex because it actually is conceptually complex or because bad syntax and language rules make it complex. In the case of CSS, it tends to be the latter. Adobe Flex makes application layout dead simple. All you need are horizontal and vertical flows, consistent alignment, and border constraints. CSS would become about 5x more intuitive and productive for web app development if it just added these basic features and allowed us to escape its cryptic realm of floats, blocks, and display:inlines.
- lwhi 16y agoThere's nothing cryptic about floats, block elements and inline elements. But you need to make an effort to learn about them! People assume that CSS should be easy / that they won't need to learn extra skills - and are then annoyed because it doesn't work in the way they assume it should. Imo, it's a pretty ridiculous situation - how can a person judge something they don't understand?
- danenania 16y agoThat's the point--it shouldn't take much effort. It's a simple problem made difficult by poor syntax and metaphors. I do understand CSS. I've created plenty of fairly complex layouts with it. That's what allows me to judge it as inferior to other layout models I've used. Why shouldn't it work the way people assume? I see very little benefit for this trade-off, except perhaps for the salaries of CSS gurus.