CSS: a static standard

CSS was first conceived when the web was mainly constituted by static pages. During all these years, the web is evolved until it became an actual dynamic media. In fact, CSS rendering takes place only when the HTML structure is fully constructed. Thus, CSS works on a finite state where everything is determined in advance. However, this implies some limits. First of all, a web developer cannot build a layout if all of its possible variables are not well-defined. Take the case of dynamic columns for example: if you have, say, three columns that contains three different images with random sizes, it's very difficult to build a layout that will scale well when the window size changes. Sure, you can align these columns using floats, but you cannot change their size to fit the dimensions of the browser window. You may say that you can use percentage lengths to perform this task, but even in this case you have to know in advance the actual size of an image, because percentages are actually computed in pixels and if you specify a wrong percentage dimension, the image will appear distorted.

W3C is actually taking this problem into account by introducing new properties in the CSS 3 modules. For example, an interesting property that should help web developers building complex layouts is the CSS 3 version of the display property. But even in this case the problem of dynamic web sites has not been solved. In my opinion, the only thing that a web developer can actually do is to combine CSS with JavaScript in order to gain more control over dynamic pages. However, the CSS web community is pretty conservative, because it's often said that CSS can do everything and that it should be used as a stand-alone standard. This view of the problem is rather utopian, because it doesn't take into account the aforementioned problems. Based on my personal experience, I think that a more pragmatic approach works better in situations like this.

This entry was posted in by Gabriele Romanato. Bookmark the permalink.

5 thoughts on “CSS: a static standard”

  1. There is much irony to be found in the way that CSS requires static definitions for positioning in a web world that's driven by dynamic content.

    Additional irony is found in the need to embed 5 layers of divs to pseudo replace the capabilities of a table, which is a solution that often breaks at least one browser. Also, that most use static widths, often based on px, when the web mantra is that the web is not the same as print.

  2. There is much irony to be found in the way that CSS requires static definitions for positioning in a web world that's driven by dynamic content.

    Additional irony is found in the need to embed 5 layers of divs to pseudo replace the capabilities of a table, which is a solution that often breaks at least one browser. Also, that most use static widths, often based on px, when the web mantra is that the web is not the same as print.

  3. I have no problems using CSS2.1 on dynamic pages; what problems do you have?

    Why would you use "5 layers of divs to pseudo replace the capabilities of a table"?Why not use a table?

    If you are using DIVs for layout, there is rarely, if ever, any need for 5 layers.

  4. Thanks for the comments. The scope of this post is primarily related to the difficulties we encounter with web sites when we do not know some possible variables. It's all fun and games when we know that each block should be exactly 200px wide or when each image is exactly of the same dimensions. But when such variables are not known, things get really hard to handle. Currently CSS has no clear way to handle this, apart from some proprietary implementations of behavioral expressions in Internet Explorer which, of course, are not standard.

Leave a Reply

Note: Only a member of this blog may post a comment.