aPaddedCell Article: Using Grids in Web Design

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

Here's the article summary:

Using a grid to define your page layout results in a more attractive,
logical layout. A grid is simply a regular series of lines and boxes that
define sections of a page. A solid structure makes layout decisions easier and
helps create a pleasing layout. This article will explain what a grid is,
provide some real-world examples, and outline a step-by-step process for
designing with grids.

Read it now

Post any comments, suggestions, questions etc. here. Hope you find the article useful!

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Good concept and something new web designers should read.

Might I suggest referencing a couple CSS frameworks that follow this structure. The Golden Grid is one of them that I have come across in the past.

He has: 629 posts

Joined: May 2007

My one beef with most frameworks out there is their dependence on pixels for sizes. Even when designing a fixed width layout, I use percents for left and right margins and padding on nearly all structural elements.

Why do I do this? Well, the technology is constantly changing. Yesterday's cool 800 pixel wide screen soon became today's 1024 pixel "standard." Most of today's crop of computers have higher resolution, while the use of hand-held devices is rapidly getting more common-- more change is inevitable.

By using percents, I can change the width of my entire design and everything else pretty much adjusts. If I were to use pixels, imagine the pain of changing page width.

Just a thought.

Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

while the use of hand-held devices is rapidly getting more common-- more change is inevitable.

I don't think that means that the layout has to be fluid enough to handle a 1680px widescreen all the way down to a 200px phone. In a case like this, I would design a special mobile theme and use that one as necessary. Otherwise, I use a fixed layout.

A couple months ago, I was setting up computers at a flooring showroom. They had me setup a computer that was connected to a decent sized LCD TV for showing interior designs. Well, of course I couldn't keep myself from seeing my websites on that awesome TV after I setup the computer...to test it of course Smiling. My sites with fluid layouts looked bad when you stretch it out beyond what you thought was possible on an original computer. Since then, I have used fixed layouts or *maybe* a layout with max&min-widths. With ginormous (sp?) widescreens becoming the norm, designing a fluid layout that can stretch to that width and still fit on the standard 1024px screen is difficult...more than it's worth IMO.

He has: 629 posts

Joined: May 2007

Heard of max-width, pr0gr4mm3r ?

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Since then, I have used fixed layouts or *maybe* a layout with max&min-widths. With ginormous (sp?) widescreens becoming the norm, designing a fluid layout that can stretch to that width and still fit on the standard 1024px screen is difficult...more than it's worth IMO.

Wink

greg's picture

He has: 1,581 posts

Joined: Nov 2005

webwiz wrote:
Heard of max-width, pr0gr4mm3r ?

6 months back I was looking into the usefulness of max and min widths, seemed like something that could be very useful and give a great deal of control over the layout.
But as far as I recall from then, none of them work in Internet Explorer.
max-height
max width
min-height
min-width

While workarounds can be done for IE specific visitors, I really don't see the point in making a site for a lower percentage audience and then adding a work around for the browser with the most users.

Nice tutorial Megan!

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

This is the workaround for IE:

width: expression(document.body.clientWidth < 742? "740px" : document.body.clientWidth > 1202? "1200px" : "auto");

It's not that bad really.

greg's picture

He has: 1,581 posts

Joined: Nov 2005

Hmm, it's not too bad. Although I don't work with JS, so if it doesn't just work from a copy and paste then I'd be stumped (or forced to learn bits of JS, which I try to avoid)

I presume this wont work if they have JS disabled ?

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

It's just using the Ternary Operator, which is also available in PHP:

<?php
// Example usage for: Ternary Operator
$action = (empty($_POST['action'])) ? 'default' : $_POST['action'];

// The above is identical to this if/else statement
if (empty($_POST['action'])) {
   
$action = 'default';
} else {
   
$action = $_POST['action'];
}

?>

..so the code in the prev post can be explained like this:

if document.body.clientWidth < 742
    740px
else
    if document.body.clientWidth  > 1202
        1200px
    else
        auto (fluid)
    end if
endif

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

I'm pretty sure min/max width work in IE 7, just not IE 6 - or am I wrong??

By the way, if you're interesting in working with grids in a fluid layout there are a few articles that can help:

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

nice article, I just emailed the link to some of my designer colleagues

so, why don't you guys have "email this article" "add this" and other viral tools?

a grid can be a useful guide, but a gifted designer knows when to "break the rules" - otherwise too strict adherence to a grid can result in a boxy look

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

decibel.places wrote:
so, why don't you guys have "email this article" "add this" and other viral tools?

We used to... can't remember when/why we took them off!

gadget_monkey's picture

They have: 9 posts

Joined: Apr 2009

I read the article, and its quite helpful
to a web design newbie like me. I've been learning
how to work with grids these past few days
and the article helped a lot. thanks.

He has: 629 posts

Joined: May 2007

The beauty of CSS is that you have so many design choices. In addition to "fixed" and "fluid" designs, and the "elastic" (Fluid with min and max widths) there are several others.

You can offer multiple styles using alternative stylesheets or either client-side or server-side scripts as pr0gr4mm3r hints at. With media queries getting quite good support, you can even accomodate iPhones and pr0gr4mm3r's giant TV display in a single stylesheet.

Yet another design I have used is Mike Purvis's "Jello Mold"[1]. SImply by changing a percentage between 0 and 100 the layout varies from fixed through fluid and anything between.

To get back to the subject -- Megan's article -- the beauty of her proposal is its adaptability. Once you have calculated the sizes the way she suggests, simply by converting the interior widths from pixels to percents, you have the basis of an almost infinite number of use cases, far beyond the fixed widths that she uses in her example.

The article is great for beginners-- but not only.

[1] Features of the Jello Mold

Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;

MartyThornley's picture

They have: 2 posts

Joined: May 2009

There are a lot of great takes on the grid idea. While I try not to get too locked into any one way of thinking or approaching projects, I do use a Photoshop Template that has a series of grid overlays to help line up page elements.

I combined three or four .psd files that I found in my research about grids and recently made it all available on my site, complete with detailed instructions on how I use it.

You can find it here.

It uses a 10x10px and 60x60px grids to fit into a 960px wide layout. It also has 50x50 and 100x100 for a 1000px layout. It uses transparent overlays to divide the layout into 2,3,4,5,6,8 and 16 column layouts. On top of all that is a browser overlay to see what the design looks like on small monitors.

I tried to think of all of the factors that I need to keep in mind when starting a new design but I would love to hear feedback or ideas for improving it.

[Edited: Please keep personal links to the signature]

He has: 629 posts

Joined: May 2007

pr0gr4mm3r wrote:
I don't think that means that the layout has to be fluid enough to handle a 1680px widescreen all the way down to a 200px phone

FWIW that's exactly what I am attempting for the site I am working on now. Safari, Opera, and Chrome support media queries, as does Firefox 3.5, so that's what I'm using.

So far it seems to work well.

Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;

gausarts's picture

He has: 11 posts

Joined: Jun 2009

CMIIW, I think grid is a CSS approach to table layout:) The beauty of grid system which makes it different from table is you may design a totally rigid box models or even out of the box ones just as easily.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.