Hacker News new | comments | ask | show | jobs | submit login

CSS does have its limitations, however I'm not convinced providing full DOM manipulation is a good idea. I admit it does solve the problem and provide greater flexibility, but the downside is that it'd be very quickly misused with content and presentation becoming more tightly coupled as people start using the convenient CSS DOM manipulation with dynamic pseudo-classes for interactivity and removing many of the accessibility advantages that CSS has. There's also very real unaddressed problems in terms of creating a readable syntax, maintaining CSS code with injections all over the place and potential browser rendering issues. To me, the cure seems worse than the disease, and the Advanced Layout Module, despite its ugliness, is probably a better solution.

CSS3 has gone a long way towards improving selectors, and I'll be the first to admit calc is undoubtedly both necessary and long overdue. I'm not fussed either way by CSS variables - I can see both sides of the coin.

Can accessibility really get any worse? Extremely few websites are accessible today. If it weren't helpful for SEO, nobody would bother with it at all.

Can readability get any worse? Nobody really understands floats. This is a layout language in which people regularly boast about how they achieved three-column layouts. Think about that for a second.

And if you look at the code that achieves said three-column layout, it is impossible to tell what it does without comments. That's because CSS is written out as a set of spring-loaded contraptions all interacting with each other, meaningless without the "cascade" of DOM elements just so, and a browser model just so. There's nothing like "three_column_layout(node, node, node)".

As far as I can tell, your thesis is that because CSS is underpowered, this will help us maintain accessibility. That's totally backwards! There will always be requirements for complex layout and interaction. That part of the job is not going away. So something's got to give. The artistic people go to Flash, the scripting people just do it with tables, and the server-side programmers go for some toolkit that pretends the browser is Java. Very very few people have the sheer bloody-mindedness to do the right thing and learn every last browser quirk and the so-called CSS model.

CSS is DEAD. It is not the basis for a better future.

I'm going to break down the differences between my opinion and the original articles and hopefully your opinion.

I admit CSS has its problems, and the core one is this: it's too complex to create good designs, and it's too easy to hit a brick wall. We can all agree on this.

The most fundamental things about CSS aren't a problem. The cascade is sane, and is probably the best thing about CSS. It makes sense, it's fairly intuitive and can be describe in a couple of sentences. For styling, aside from the ugly non-JavaScript compatible syntax and the occasional unintuitive property-name choice, we're in pretty good state generally.

The two biggest, and very real, problems are the unintuitive box model and layout model. Everyone should agree with this.

I'll first deal with the relatively simply box model problem. The W3C box model was incredibly poorly thought out and makes like incredibly and unnecessarily difficult. It's simply inside-out. The width should refer to the total width of the box as in IE4 and quirks mode: this makes things wonderfully intuitive, makes things look as you expect and allows you to mix different units with ease. As it is, it width refers to the inside of the box and the real width is the inside width + border + padding. This is quite obviously nuts. There are two fixes to this problem: a nastier backwards-compatible one, and an actual nice solution. Both are in CSS3, and it gets full marks from me here. The first fix is to provide a way of calculating values so you can easily mix percentages with pixels. This is in CSS3 as the calc function. The second fix is switching to the traditional sane box model. In CSS3 there is a property to do this - add "box-sizing: border-box". So far, CSS3 gets full marks from me.

The second core problem is layout. We currently have the "float model". I put them in quotes because it's not so much a model as people meeting the limitations of CSS2 but wanting many of the advantages of it and finding a way around them using floats. Presumably when CSS2 because a recommendation in 1998 the web looked like a very different place, the limitations of the model weren't considered a big problem, and then we were left in standards limbo which left us for several years without a decent CSS2 implementation and no table-replacing display: table implementation in the major browsers in sight. And up until now the only usable, accessible CSS model we had was arguably designed for something else entirely - the task of allowing text to flow around images on normal layout pages. To say this dirty hack is lacking is obvious an understatement, and that's excluding working around CSS bugs, but I'd still argue it's the best thing we have and the accessibility advantages and content seperation are worth the dirty hacks.

And so we have where we are today and our problem - how do we provide a good, natural, way to make layouts?

And any answer to this leads us to the fundamental subquestion and finally to where we started this discussion: how seperate do we want our content and presentation to be?

This is actually a difficult, and slightly, ideological question. The more you seperate content and presentation, complexity of both the spec and language goes up, flexibility goes up, inherent accessibility goes down and so does inherent maintainability. The "completely" solution results in DOM injection, the "not completely" solution results in something nearer to the Advanced Layout Module.

And this is where our fundmental differences clearly lie.

I believe that forcing a reasonable amount of semantic ordering within content is a good idea as it helps encourage a certain amount of inherent accessibility as content has to be ordered. I believe that any syntax that would allow DOM injection would be inherently ugly syntax and not fit well within CSS. I believe that any syntax would have to be very carefully chosen to work at all. I believe that if you want ultimate control over the appearence of the page, you always have JavaScript and jQuery at your disposal.

And you, and the article, believe that the advantages of flexibility outweighs my criticisms, and CSS would be underpowered without them.


And to go back to your own post:

Accessibility can get worse, and CSS3 is looking like it will improve the situation.

Readability can get worse - floats are a dirty hack especially when combined with CSS hacks for dated browsers and as such inherently aren't readable, but adding injection into the mix won't automatically make life better.

And yes, floats are a dirty hack and aren't an indicator of the future of CSS either way.

CSS isn't really inherently underpowered: it depends how you see it. At the moment it needs fixing either way

And CSS isn't dying at all, and CSS is going to be completely reborn over the coming years. Flash is still dying - Flash was always a dirty hack. CSS's display: table is going to replace with CSS as soon once IE7 dies in about 5 years. And CSS is getting better, compatability is improving and CSS3 is going to better than CSS2 whatever it chooses: DOM injection or not.

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