Advertisement
Promo

Become a member of the ZDNet UK community

Jake Rayson

View blog's RSS Feed

Web design & FOSS

Front-end web technologies and Free Open Source Software.

Tuesday 17 June 2008, 12:52 PM

One True Piefecta

Posted by Jake Rayson

Meanwhile, back at The Ministry…

For Operation Cleanup on the intranet, I needed a 3 column CSS layout, and I opted for One True Layout to create the page layout — cross-browser, fixed width, any order columns, fairly simple to understand. All in all, rather a neat solution, thank you Alex Robinson.

As you can see, the CSS is clean and tidy:

/* Fixed pixel version */ body { text-align:center; } /* Necessary for centering #wrapper in IE5.5 */ #content { float:left; width:550px; margin-left:180px; } * html #content { display:inline; } #sidebar { float:left; width:254px; } #sidenav { float:left; width:180px; margin-left:-984px; } #wrapper { width:984px; margin:0 auto; text-align:left; } #footer { clear:both; } #header, #footer { width: 984px; }

And the HTML is minimal as well:

<body> <div id="wrapper" class="clearfix"> <div id="header"></div> <div id="content"></div> <div id="sidebar"></div> <div id="sidenav"></div> <div id="footer" class="clearfix"></div> </div> </body>

But when The Ministry saw the design, they wanted it changed to something more flexible, because a considerable percentage of their users have a maximum screen resolution of 800x600 pixels, poor buggers. (25% of their users still have Internet Explorer 5.5 :( ).

So, two fixed outer columns (also because I'm using fixed-width Mountaintop Corners as well). Plus a semi-liquid content centre column that has a max-width for legible line length and a min-width to maintain the structure of the page. “Gadzooks” I thought “where could I possibly find such a layout at such short notice?”.

Luckily I tripped over some Jello Piefecta, which is an eerily good fit for all of the above.

Piefecta is a three column CSS layout from way back in 2004, which I used on the UpMyStreet redesign in 2005. Jello is a technique for creating semi-liquid layouts that work in IE without JavaScript. Put the two together and you have a potent CSS layout cocktail which meets my needs perfectly.

The downside (there’s always a downside, no matter how good the news ;) is that the HTML structure is comparitively clunky, and the column order has to be 2-1-3 rather than 3-1-2:

<body> <div id="sizer"> <div id="expander"> <div id="header"></div> <div id="wrapper1"> <div id="outer"> <div id="float-wrap"> <div id="content"></div> <div id="sidenav"></div> </div> <div id="sidebar"></div> </div> </div> <div id="footer" class="clearfix"></div> </div> </div> </body>

And the CSS is relatively convoluted, 70-plus lines long, with all the necessary comments.

I spent a few hours stripping out the unneccessaries, and trying to work out how get what I wanted (I used borders on the columns rather than margins to get around box model hacks for IE5.x), and to work out how adjust the column widths.

This has prompted me to consider publishing commonly used CSS/XHTML snippets of stripped-down code that can be used time over, by myself and also by others. The other candidates for such a repository would be lorem ipsum, XHTML templates, HTML entities, HTML color names etc.


Comments on this post

Jake Rayson

This member is ranked #3 in our top 100

  • Jake Rayson
  • Web / Multimedia Developer, North Kent
  • Member since: November 2006

Site Activity Rating 6

CoreTechs

Contacts' Latest Discussions

Number of Tracked Discussions: 2,316

roger andre roger andre

Microsoft begins work on Windows 8

Thursday 3 December 2009, 1:02 AM

2 comments
ator1940 ator1940

ACTA

Wednesday 2 December 2009, 12:07 PM

7 comments
ator1940 ator1940

Real security

Tuesday 1 December 2009, 4:21 PM

2 comments

Contacts' Latest Blogs

Number of Contacts Blogs: 8

Avatar David Meyer

Nokia halves smartphone portfolio

Friday 4 December 2009, 5:03 PM

1 comment
Avatar Karen Friar

HP workers set dates for strikes

Thursday 3 December 2009, 7:57 PM

2 comments

Skip Sub Navigation Links to CNET Brand Links

Help

Become part of the ZDNet community.

Newsletters