Mark Pilgrim in a well reasoned argument in favor of using CSS instead of tables for web layout. The debate is not new, but some prominent web developers don't agree. Follow the links from Mark's essay.
Let me try and give a language design point of view.
Languages are abstraction tools. When you describe something at the appropriate abstraction level, it is easier for you to describe it efficiently and correctly and at the same time your description is easier to understand.
Consider a simple for loop. Languages that provide this common looping structure allow the programmer to inform both the compiler and the human reader that the the number of iterations through the loop is known in advance, as opposed to the situation with while loops. This helps optimization, but also helps reading the code and proving it correct. [If you think I am wrong about this, chances are you are used to a language without this distinction, the most prominent example being C.]
CSS is a domain specific (declerative) language. It focuses on presentation details. It may be a bad language - I am not analyzing its strengths and weaknesses. Most of the advantages attributed to CSS are the result of this fact. CSS eases maintenance? Of course. The language localizes the presentation details, and separates them from the actual content. It also allows you to specify presentation details using concepts that were deemed appropriate for this task. CSS helps tools understand your site (e.g., tools for the disabled)? Sure. In just the same way as a for loop easier for the compiler to reason about.
One of the interesting characteristics of the web is the plethora of domain specific little languages. These languages can explain some of the success of cross-platform browsing, and the abundance of plugins and supporting tools.
An important feature of many, if not all, of these languages is that they are easily embeddable inside one another. Indeed, even the specification of tables can be seen as a micro-language inside HTML.
Remember: It is all about choosing the appropriate abstraction level.
Posted to Logic/Declerative by Ehud Lamm on 2/17/02; 9:30:49 AM
|