The topic under discussion
- Separation of concerns
- A content versus presentation paradox
- Content defined by layout
- CSS & mark-up tangled together
How content can constrain layout
Since 1995/6, many web pages have had their overall layout controlled by the use of tables. Blocks of content that a designer thinks should be side-by-side have become the cells in a single row of a table. Blocks of content that the designer thinks should be vertically aligned have become equivalent cells in different rows of a table. Visual browsers typically render tables as rectilinear arrays, as they are recommended to.
Some people claim that this is wrong because it is inflexible. They say that if the layout were controlled by CSS (often called "CSS positioning") then dramatic changes to the layout of all pages could be achieved simply by changing the CSS. They claim that it wouldn't be necessary to change the pages themselves.
In fact, the layout of those pages is often constrained by much of the the content already developed for them. Often the layout changes that can be achieved just by changing the CSS are limited.
What this discussion is not about
This discussion is not about "CSS versus no-CSS". There is no doubt that making extensive use of CSS enables significant changes to be made to all relevant pages. This particular page uses CSS for both layout and other styling, and has very few presentation attributes in the HTML, which is valid 4.01?Strict. It just specifies images sizes, which is normal practice.
The example: the "3 column layout"
Consider a typical 5-box 3-column page, for example as used by news sites the world over.
There will typically be 5 boxes, each containing plenty of material. First, there will a banner across the top. Then there will be 3 columns down from the banner. Often these will be a left-bar, then an article, and then a right-bar. Finally there will be an administration box (footer) across the bottom, just below the longest column.
Obviously, details will differ within these 5 boxes. Some of the detail, especially in the banner across the top, may be achieved by the sort of "micro-formatting" that is not part of this discussion.
2 column versions of this basic theme are even more common across the web. Much of what is said below applies to them too. This current page is an example, and some of its content has been developed to fit the chosen layout.
The design & development of such pages
It is typically obvious that pages using this 5-box, 3-column display were intended to be that way from the start. The contents of each of the 5 boxes will have been designed and developed for its chosen box.
- If, for example, a search box is to go into the left-bar or right-bar, the input space will typically be small so that the input form will fit into the assigned width. But if it is to go into the banner at the top it is likely to be longer. It will rarely if ever go into the footer at the bottom.
- Photographs & images (& flash) intended for the left-bar and right-bar will tend to have limited width, often just about what the CSS (if any) assigns for the width. (Sometimes such images are quite tall). Photographs & images intended for the banner may well be much wider. (Images in the footer, if there are any, tend to be icons & buttons). (The images in the sidebar of this page were developed for the chosen width of this sidebar. The width of the sidebar cannot be changed just by changing the CSS. Neither can it easily be converted to a horizontal site-navigation block).
- Link-texts in the left-bar and right-bar are likely to have short, snappy, lengths, to appear as buttons. Contents of a particular side column are often of a similar width, and often not within the control of the CSS. They were often predetermined by the details of the content long before. It is typically obvious that the left-bar and the right-bar have been dictated to have a fixed, relatively narrow, width. (That applies to the link-text in the sidebar of this page. The "button text" was decided-upon to fit within a certain width).
- Links in flexible content in the centre column are more likely to be longer. Quote-boxes, often floated to the right in articles, are far more likely to be in the centre column than in either the left-bar or the right-bar. (That applies to this page).
- Often there is replication from one page to another of (say) the left-bar content. It is obvious that this replicated content was not intended to have centre place. (That also applies to this page). The contents of the footer are pretty predictable, and often standardised from one page to another.
The entire design & development process for such a page, and indeed for much of such a web site, has typically been based on the assumption that this will be a 5-box, 3-column display, with particular widths, at least for the sidebars, and often for all boxes.
The tableless version
The technique for making the content suitable for tableless 3-column rendering is fairly standard:
- Put all the material that is to be seen in the banner across the screen at the top together in the document. Then surround it with (say)