html vs css pt1

June 12, 2008

It's time to put all the color and css experimentation behind us for a while. This article will serve as a small introduction that will describe my reasons for writing the next batch of articles. Since they might be considered a little controversial, I thought it wise to spend a little time documenting the situation as I see it, before starting with the articles. The battle between html and css is now officially opened.

battle of the giants

the theory

In the grand scheme of things, html is way more important than css. html is a way of marking up data on the web, as to make sure everything and everyone is able to use and understand it. It brings structure and meaning to data so not only humans, but also machines and programs are able to interpret the data online. In comparison, css is only a way to visualize that data, be it on screen somewhere else (ie. print). This visualization might be important to us humans, software doesn't really care about that.

It's also a lot easier to write good html than it is to write good css. Better browser support and less freedom are a few of the reasons why we can now write pretty good to excellent html documents. It's a bit more complicated when we are writing css. Lack of browser support, lack of much needed functionality and little theoretical reflection makes our css files into plain battlefields.

These are probably the most important reasons why html has won the battle over css. We see html as the core of publishing data on the web (which it is) and we adapt our css to that. Which is fair enough really, if we'd be living in a theoretical world.

the reality

But ... of course there is a big but. When I look at the problems I face every day at work, I can say that are mostly related to css. And part of those problems are caused by the drive to write perfect html code. So along the way I tried to restore the balance between html and css a little bit, as to make my work a little easier. Because no matter how you look at it, visual presentation of a site is for most people (project managers and users) still the main priority.

Of course, I'm not talking about adding 7 wrappers around every element to make sure I'm covered all the time, but I don't mind adding small things that add little complexity to the html and serve as a good simplification for my css code. In the following articles I will be describing some of these decisions to illustrate my point.

People who can't stand an extra <span> or extra css class should be warned to approach these articles with caution, but even they should consider the trouble they're making for themselves by trying to fix everything in css.

Stay tuned.