The fundamental problems with CSS3
mattwilcox.net
mattwilcox.net
There's no real laws you can put against Microsoft, but if this were a real world situation, we'd be trying them for crimes against humanity. They have effectively ceased innovation for an incredible amount of time, and I would go ahead and say that they've slowed down the exceedingly fast development of the last decade.
CSS3, Javascript 2, HTML 5, XHTML 2, etc. should've came out years ago. Possibly in different forms, but nonetheless this monopolization over a browser market has killed _everything_.
I am glad that Google is getting into this game. Not only because it will definitely give Microsoft a run for its money, but we will finally have new innovation that before seemed to take years to implement.
As a fellow developer, I'm about a commit a heresy down to text:
"Most people don't want fast development."
People may claim they want change or for things to be "done with" in a timely matter, but the reality is that change brings disruption in economic, social, and political terms. Take a look at IP4, for example. IP6 just isn't getting traction because the problems it solves have now become "features" to many people. (NAT being one of the big ones, since it's gotten the perception of being a security feature.) My job involves working with IE 6, since my organization refuses to update our systems to even use IE 7, much less standards-compliant stuff like Chrome or Firefox.
Simply put, if MS was sent to trial for "crimes against humanity," the jury of "peers" who would to be selected would acquit them. Why? Because the court would likely consider "peers" to be end users, business men or the ignorant, not developers or technologists like us.
The internet is no longer the download-from-website model that it was years ago. There is a massive amount of user participation now, which is why upload caps are increasing as services like video chat, peer-to-peer gaming, etc take off.
And now you tell them only one person can initiate a video chat from behind a single router. The user is annoyed. Or you tell them that you can't both be playing the same game at once on two computers due to a port conflict.
IMHO there's a real need to get NAT out of our system, and there's a very real consumer benefit to doing so. It directly opens doors to services and products that people are already clamoring for.
People expect innovation to happen in "Internet Time" -- but that is a myth, born of hype and bubble thinking. In the real world, it takes on the order of decades for people to even grasp the full potential of the existing HTML/CSS/JS standards and de facto standards. [1] I just don't think innovation in computing is being particularly held back by these technologies. [2] They're not the bottleneck.
Consider some popular Web 2.0 sites: Wikipedia, Facebook, Twitter, Flickr, even Google. If you were transported back in time to 1996, you might find it difficult to replicate some aspects of these services (for example, your hardware and software bills might cause you to lose consciousness -- do you have any idea what 1GB of RAM used to cost?!) but the primitive state of the HTML standard would not hold you back. Your site would be butt-ugly (no CSS yet!) and/or employ dozens of horrifying <table> hacks, and you'd be stuck doing lots of full-page loads (no JS yet!) but it would work just fine.
Why weren't all these things built back in the 90s? The reasons are different in each case (Wikipedia and Facebook required a critical mass of web users; Flickr awaited the development and growth of the digital camera market -- the Apple Quicktake, one of the first digicams, was released in 1994; Google arguably did exist back then but it was called "Yahoo" or "Altavista"; Twitter just hadn't been thought up yet!) but none of them had anything to do with poor web standards.
You might argue that Ajax apps like Google Maps or Gmail are being held back by web standards sluggishness, and that's a stronger argument. I do think we'd see more innovative apps if we further lowered the barrier to delivering cross-platform, cross-browser apps over the web -- that's been the lesson so far. But it's not as if the situation is hopeless: you can build pretty good Ajax apps now, you can resort to Flash, or you can leverage the power of web-based education, development, marketing and delivery to ship (brace yourself) old-school desktop apps better than ever before. Nor is it the case that the standards bodies are the bottleneck here: The problem is insufficient market penetration of Webkit and/or Firefox. In other words, I'm not sure that inventing more and newer standards would be more helpful than trying to get more use out of the standards we already have.
----
[1] Witness how long it has taken for blogs, online news, and Craigslist to start actually killing newspapers, an event that has been predicted for a very long time.
[2] Of course, that's easy for me to say -- I'm not a designer or a typographer. Typographers are tearing out what remains of their hair for the lack of a better CSS standard for specifying typefaces.
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 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 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.
Scheme is a lot better but its going the way of CL, slowly but surely.
def my_meth(options = {}); options[:named_arg_1] ||= 'bob'; options[:named_arg_2] ||= 'blub' end
This still does not affect the rest of my claims. Having multiple execution models in the same language is bloated. So are many other things in the CL standard.
* Details: http://www.lispworks.com/documentation/HyperSpec/Body/03_da....
Many current frameworks are inadvertently used to bring the power of a programming language to presentation, but most of them don't seem to realize it yet.
SEO
(Reading off the DOM nodes also gives them a fresh crack at some more semantic analysis that used to be really hard, since it involved emulating a browser... did you use <span class="some_header"> instead of <h1>? They can make a better heuristic guess at that if they are "inside" a browser and thus capable of seeing that the size is twenty points higher than the surrounding text, no matter how you implemented that.)
To really pull this off, you need a browser engine that enough people are using that site designers need to account for it, and it needs to be designed with the goal of running just the engine as quickly as possible on the backend, with the ability to cut it off after a certain amount of time.
So... has anybody dug deeply enough into Chrome to have an opinion on the feasibility of running the browser without a UI?
If so your livelyhood clearly doesn't depend on SEO. I'm not gambling mine on what is currently vaporware.
Btw, people made this exact point about flash a few years ago and your pages will not rank nearly as well if you do them in flash.
I don't care about SEO. I think Google wants to see into those sites, and I don't think they much care about SEO either.
Something like, "google doesn't care about SEO therefore site s that do should use javascript frameworks instead of static html" or something?
I understand SEO is a practical necessity, but in the grand scheme of things, it sounds like putting the cart before the horse.
If your goal is to make money then yes it should if organic search traffic is a big piece of your marketing puzzle. It's not the cart before the horse if your intention is to run a business on the internet.
I've been a big part of a few successful businesses that depended on SEO. Without it they would not have succeeded.
For example, you have a blog post with comments and a form that allows you to post new comments. When a person visits the page, the HTML of all current comments is loaded. The code to generate that HTML is on the server. But say that you want the interface to be very responsive, and when someone posts a new comment, you want to be able to display that comment in the list with others w/o waiting for the response from the server. Ideally the same code that generated the HTML for the original list can be used to generate the HTML for this new comment -- but on the client.
(Of course, to actually store the new comment, you need server side code, which I'm not saying it will eliminate at all.)
Google's recent project (Native Client) is what I've been waiting for as a C++ developer. It basically allows you to run native code(assembler) in browser. But then has security mechanism so that the code cannot do anything to the client computer unless the user of that client has given the container(Sandbox) that runs the code permission.
This will allow people to build their own UI frameworks, that render much more rich graphics and hopefully behave the same no matter what Browser/OS combination you are running on.
References:
Announcement:
http://google-code-updates.blogspot.com/2008/12/native-clien...
Native client code base hosted at Google code:
http://code.google.com/p/nativeclient/
Ars Technica review:
http://arstechnica.com/news.ars/post/20081209-safer-than-act...
Do people really think we'll ever reach a point where different vendors building code-bases based on documentation built by a committee will ever behave even remotely the same? Have you read any of the W3C documentation, it's fucking ridiculous. We should be sharing implementations, it's the only way to ensure bit-level identical behavior of a target system(Performance characteristics aside).
I really hope Native Client takes off. In combination with Gears for client side storage it would allow us to build desktop quality software but with the web advantages of cross platform development, zero install applications(well as long as you don't consider caching a form of installing), user's pulling down the latest client at all times, and etc.
Awaiting our new Google overlords. Endergen
WTF is <p> or <ul> or <div> and all that crap? I haven't seen an HTML template that looked comprehensible after a year in development.
What do they have to do with UI programming? What we really need is something like MXML or XUL, only cleaned up and widely supported by all browsers, especially IE9.
This is all pretty elementary for someone reading this site... Maybe I missed some sarcasm? :p
*Well, they do in a lot of instances, but when properly used, they have nothing to do with UI.
I don't see how swaths of divs, some of them used for semantics (according to some metadata standard), some of them used for purely presentational purposes, improve anything.
CSS people (or should I say modern web developers) are completely anal about not using tables for layout whilst at the same time the whole notion of document structure is so utterly destroyed in any JavaScript heavy app.
These priorities make no sense to me. Laying out web pages with divs and CSS is a black art. It's fragile. It breaks in all kinds of nasty ways. It reduces the productivity of UI development to pre 90s levels and leads ot entire pages done in Flash.
Tables are not more semantic than nested divs. But nested divs aren't very semantic, either. Tables are used for tabular data. Divs are used for dividing content.
"I don't see how swaths of divs, some of them used for semantics (according to some metadata standard), some of them used for purely presentational purposes, improve anything."
No one is proposing that you make every element a div. In the web standards community, we call this "divitis" and while better than table-based layouts, it still isn't semantic.
"CSS people are completely anal about not using tables for layout whilst at the same time the whole notion of document structure is so utterly destroyed in any JavaScript heavy app."
Don't lump these developers (who's code doesn't gracefully degrade for non-JavaScript users0 together with the rest of us.
"These priorities make no sense to me. Laying out web pages with divs and CSS is a black art. It's fragile. It breaks in all kinds of nasty ways."
Just because you don't understand how to make something work doesn't mean it's a "black art". Plenty of web developers are able to create semantically-meaningful documents styled (cross-browser) with CSS. CSS offers advantages, but you seem to only see (imaginary) disadvantages.
"It reduces the productivity of UI development to pre 90s levels and leads ot entire pages done in Flash."
I'm not even sure how to respond to this. It's ridiculous.
The problem is that CSS is not powerful enough to do rich layouts, and that forces developers to cripple the semantic goal of CSS/HTML by injecting presentation into what is supposed to be a presentation-free markup.
He also has a good point about the need for calculation in CSS. However I am really worried about the possible manitenance nightmare of a turing-complete CSS! It should be designed very carefully. A constraint-based sublanguage for CSS would perhaps make sense.
Lost me there. A <div> is just a vanilla block-level element. You can turn anything into a <div>.
"CSS can only be applied to elements that have semantic meaning"
You should see the CSS that developers I've worked with write. Even worse is that DreamWeaver has its "style1", "style2" way of doing things which makes picking apart a stylesheet very tedious.