The term du jour circa 2003, liquid layout, appears to have replaced with the term responsive design (2014) which, as we see it, is liquid design with a media query. Good to see the world is moving forward.
These notes describe our experiences converting from our old liquid nested table layout to our current (since mid 2003) bright shiny CSS three column liquid layout. HTML5 2013 Update: Updated prior to starting our HTML5 transition to document our change base-line. Hope triumphs over experience with HTML5 - again. This page checks out against the current (November 2013) W3C HTML5 validator with only one warning which says something to the effect of "this HTML5 may not be the final HTML5, it might not even be HTML5 and for that mater we're not even sure what HTML5 is this week". Sigh.
Note: We had originally moved to a table-based liquid design (whereby the page automatically adjusts to the users window-within-browser size) in 2001 due to a concern over the increasing range of video resolutions being offered. Though in those far-off days 1024 x 768 represented the pinnacle of expensive technology.
Well, it's not exactly crossing the Rubicon. But it was a great feeling. We had an relatively easy time converting our pages because we were able to avoid the most critical problems that many designers encounter since we are not a pixel-perfect site (though in 2004 we did a 5 layer, pixel perfect, CSS liquid layout). We've provided some notes to remind us what we had to do. If you find them useful - even as a 'what not to do guide' - then read on.
We had the following design requirements:
Single style sheet (actually not quite true because we serve up browser specific pages from our server).
Support all our target browsers with a single page layout strategy (and roughly in this order of importance).
2013 Update: We care little for the Javascript version (our javascript usage is minimal and basic) but a lot about CSS. CSS2 support using a base line of the Acid 2 tests is our current standard (CSS3 not so much at this time). Consequently, we look at the browsers rendering engine rather than the browser so our supported list today is Trident 4.x+ (MSIE 8.0+), Gecko rv 1.9+ (FF 3.6+) and WebKit 522+ (Chrome since beginning and Safari since before that). Opera Presto 2.0+ is our base but is dying since their decision to move to a WebKit base from Opera 15. Anything else is in the default category - except for MSIE 7.x which is good enough for our pages.
Our HTML markup must be standard but we will allow browser-specific variations in the CSS style sheet. (We conditionally generate pages, including style sheets, based on minimal Apache based Browser sniffing and XSSI directives.)
Keep our current look and feel (OK, OK so there are down-sides to this approach) as a starting point.
'Sectionize' our page layout such that by manipulating only CSS definitions we can change our page layout (probably an unacceptably high expectation).
Minimise site wide changes, or at least allow us to migrate at our pace.
The pages work and work well. But..
As of April 2003 we started to migrate the site to our CSS controlled (a.k.a 'table-less') layouts. We have a resonable migration scheme (with some overheads) so we can take our time. The benefits are too great - at least on our site.
Our experimental page and this page were the initial results of our attempts at 'table-less' layout. We spent a couple of days reading the web based material (a lot for us) and decided to try a pure CSS based layout which was a radical decision in 2002 (2013 Update: Surprisingly still true today). Our site is not pixel-perfect, nor do we use wide borders so a few pixels here and there is fine by us. This means that we avoid the serious problems of MSIE 5.x (it counts all borders and padding as being inside the 'box' not outside as it is supposed to do). Serious stuff if you need 'no-gap' layouts.
Our decision to include NS 4.x also caused some problems - but surprisingly few once we made one draconian decision!
Here is what we did
We created five NEW styles to layout the three central columns, the banner and the footer, we called these l-c, (center pane) l-f, (footer pane) l-l, (left hand menu pane) l-r (right hand menu pane) and l-b (banner pane) which was initially just an empty placeholder. Pages a defined to render in strict order: l-b is first followed by l-c, l-l, l-r (but only for some browsers) and finally l-f.
We decided to leave our top logo plus navigation bar as a table. It's really not significant at this stage (slapping it in a empty 'div' would have done absolutely nothing - though it proved to be essential when we moved to CSS pop-up, drop-down menus). Whether that disqualifies this as a table-less design is in our view moot. 2013 Update: Conversion to div (table-less) format in l-b circa 2004 for CSS pop-ups.
We used the glish.com 3 column layout as a starting point (which is both very simple and very effective), ripped out our three central layout tables replacing them with simple divs and clicked the refresh button!
Left Hand Menu:
.l-l { position:absolute; top:60px; left:6px; width:110px; z-index:1; }
Absolutely positions the left hand menu. This is a global definition and works for every browser in our list including hoary old Netscape 4.x. NOTE: The NS 4.x infamous 'width' limitation is only inside 'tables' and since we are 'table-less' we have no problems. Ah! to be on the side of the angels for a change!
We had previously changed all our left/right hand menus from tables into 'div's as part of our revised use of CSS so we now have nested 'divs'. However since not all our pages have been changed to the new layout this is necessary to allow for continued use of the current styles/layout. When the site is fully converted we only have to change a very small number of files (we use Apache SSI's) to remove this nested definition and in the meantime it is harmless on all tested browsers.
Finally those still awake may have spotted that our normal left hand menu 'div class="n-l"' uses an attribute of 'fixed'. When we tried 'fixed' in both nested 'divs' ('l-l' and 'n-l') MSIE did not like it at all (very bizarre results) but all the browsers that support 'fixed' (Opera/Gecko) use the second (nested) definition to give a 'fixed' attribute. We also have a minor casualty in that the hover effect 'div.n-l a:hover {color:black;}' was lost by Opera in nested divs. Sigh.
2013 Update: We still use fixed size fonts (10px, 12px and so on) in this div rather tham the em strategy of the central pane due to the strict width limits. We see no alternative.
Center Pane:
.l-c { margin:0 160px 0 125px; padding:4px; font:10pt Verdana,Helvetica, Arial sans-serif; border-width:0 1px; border-style:solid; border-color:silver; [width:100%;] }
This is a normal 'in-line' element - position:relative is the default. The margin definition controls the variable page width by fixing the left and right hand margins (they are subsequently overlaid with the l-l and l-r divs) leaving anything else for the central pane. This 'div' is browser-specific. Some browsers need the 'width:100%;' and some choke on it.
The page actually worked perfectly well without the 'width:100%;' until we came to resize in Netscape 4.x when all kinds of bizarre things happened. Adding the 'width:100%;' attribute fixed NS 4.x. Then we re-ran the tests and MSIE took 100% literally! So add for Netscape, leave it out for MSIE and don't care for Opera and Gecko.
2013 Update: In 2007 we changed our font strategy to use em units to make it easier for accessibility users. The font definition in the div is now 1.0em (and we also added a line-height:1.3em to open up the text). All class definitions used in the l-c div define their fonts relative to this base, thus, 120%, 80% and so on. The net result is that if the user has modified their style sheet to use a larger font type we do not override this change by using explicit font sizes. The negative consequences, which are not a problem on our site, is that the site owner has much less control over the look and feel of their site. This is offset by the greater control exercised by the site's users, which can only be positive.
Top Banner:
In the first phase of conversion we left this as a table and let the 'l-c' div flow normally (postion:relative is the default) under this table. When we moved to CSS menus we had to place the banner in a position:relative div for Gecko and Opera browsers only (the only ones that support CSS menus) as shown below:
.l-b { height:45px; padding:5px 5px 0 5%; }
Essentially the div just positions the logo image inside the page and provides a bit of space. We left the MSIE implementation as a table because we we could not get the javascript positioning to work with pop-ups when using the div. So we have natural flow from 'l-b' through 'l-c' to 'l-f' with the two side menus being absolutely positioned. Worked great except we noticed that our CSS pop-ups did not pop-over the right menu div. To fix this we needed to give the 'l-b' div a higher z-index which in turns means that the div must be absolutely positioned (z-index only works with position:absolute). So we modified 'l-b' as shown:
.l-b { height:45px; padding:5px 5px 0 5%; position:absolute; left:0; top:0; z-index:9; }
This works well for Gecko but not Opera which seems not to like the fact that the google adds are placed last and continues to place the pop-ups under them. One day life will be perfect. But it also had the unfortunate effect of sliding the 'in-line' 'l-c' div up under the banner! So 'l-c' was modified as shown here:
.l-c { margin:45px 160px 0 125px; padding:4px; font:10pt Verdana,Helvetica, Arial sans-serif; border-width:0 1px; border-style:solid; border-color:#336; [width:100%;] }
Addition of the top margin (45px) clears the banner header and means this div continues to be 'in-line' and importantly the following 'l-f' (footer) div flows to the bottom of the page as normal.
Right Hand Menu:
.l-r { position:absolute; top:60px; right:6px; width:150px; [visibility:hide;] z-index:2; }
There are always casualties. This style absolutely positions the right hand menu with the 'right' attribute. This is a browser specific definition. Unlike the 'width' attribute Netscape 4.x does not have a buggy implementation of 'right' - it DOES NOT HAVE ONE. We're talking a serious NONE.
We experimented briefly with 'left:92%;' etc. but it was just too messy and not accurate enough. We made a decision to start de-committing NS 4.x support from the site in late 2002. Sensible display but no new work. The quickest way out was to leave everything untouched and use 'visibility:hide;' to make the right hand menu invisible in our browser specific style sheet for NS 4.x. The right hand menu is there for everyone else except NS 4.x users. End of an era. Sad really.
2013 Update: In 2002/3 Netscape was one of, effectively, only three browsers (MSIE, Moz/Gecko, NS). Our default handling for browsers not in our core group - including those using cloaked Browser IDs - now uses the old netscape styling.
Footer:
div.l-f table{ width:100%; padding:4px; } .l-f { margin:0 160px 0 125px; } .l-100 { width:100%; margin:0; } <!-- HTML footer fragment --> <div class="l-f"> <div class="l-100"> <!-- footer table with no width - see selector --> </div> </div>
These two crummy footer lines took the longest time - ain't that always the case. We had a footer which stretched 90% of the page and was nicely (well in our view) spread out in three columns.
We started by wrapping our normal footer table in a null 'div' (border:0;). Worked perfectly except for short pages, when one or other of the left or right hand menus sat on top of it. We found a couple of articles that suggested that use of 'clear:both' in the footer div would place the footer below the longest absolutely positioned menu - we could not get this to work so we clearly have something that fights this fix - but we have no idea what it is.
The obvious solution is to place the footer inside the central pane. But to keep the 'stretched out' look that we cherish (!!) there is a width="90% attribute and MSIE does nasty things with width inside a 'div' - it just blew the central pane to bits (kept wanting to write a whole screen width). Take out the width and we get the table 'scrunched' up in the middle of the page. So after hitting the web (seems almost nobody is using complex footers in 'table-less' designs) and a lot of experimentation we ended up with a nested 'div' solution and relative positioning - flows from the end of the 'l-c' div (both 'l-l' and 'l-r' menu divs are absolutely postioned). In spite of all this work NS 4.x still 'scrunched-up' the footer. Sigh.
Problems, comments, suggestions, corrections (including broken links) or something to add? Please take the time from a busy life to 'mail us' (at top of screen), the webmaster (below) or info-support at zytrax. You will have a warm inner glow for the rest of the day.
Tech Stuff
If you are happy it's OK - but your browser is giving a less than optimal experience on our site. You could, at no charge, upgrade to a W3C standards compliant browser such as Firefox
Search
Share
Page
Resources
HTML Stuff
W3C HTML 4.01
HTML5 (WHATWG)
HTML4 vs HTML5
HTML5 Reference
W3C Page Validator
W3C DOCTYPE
CSS Stuff
W3C CSS2.1
W3C CSS2.2
Default Styles
CSS3 Selectors
CSS 3 Media Queries
CSS 3 Colors
DOM Stuff
W3C DOM
W3C DOM 3 Core
W3C 3 Events
Accessibility
usability.gov
W3C - WAI
Web Style Guide
WebAim.org
Useful Stuff
Peter-Paul Koch
A List Apart
Eric Meyer on CSS
glish.com
Our Stuff
Our DOM Pages
DOM Navigation
Liquid Layout
CSS Short Cuts
CSS overview
CSS One Page
Javascript Stuff
Site
Copyright © 1994 - 2024 ZyTrax, Inc. All rights reserved. Legal and Privacy |
site by zytrax hosted by javapipe.com |
web-master at zytrax Page modified: January 20 2022. |