The 1140 grid fits perfectly into a 1280 monitor. On smaller monitors it becomes fluid and adapts to the width of the browser.
Beyond a certain point it uses media queries to serve up a mobile version, which essentially stacks all the columns on top of each other so the flow of information still makes sense.
Scrap 1024! Design once at 1140 for 1280, and with very little extra work, it will adapt itself to work on just about any monitor, even mobile.
Brought to you by web design agency
See also simple grid and fluidhtml
Twelve divides into even columns of two, three, four or six.
Or into numerous uneven combinations like seven and five or five, four, three.
The last example is as simple as three divs with the classes .fivecol
, .fourcol
and .threecol
By mobile, I really mean smart phones. I'm not even attempting to support WAP phones or anything old like that. But it does work on devices that recognise 'handheld' in the style sheet media and/or media queries. With media queries you can even include x2 images for the iPhone 4 Retina Display.
So far I've tested it on a couple of MacBooks, an iMac, a PC laptop, an old PC, an Eee PC, an iPad, an iPhone 3G, an iPhone 4, a few Android phones, a Samsung Galaxy Tab, a BlackBerry and an older Nokia.
It works perfectly in Chrome, Safari, Firefox, IE7 & IE8.
It works alright in IE6. IE6 doesn't support max-width
, so the grid doesn't fix to 1140px. It spans the full width of the browser. Most people using IE6 probably don't have monitors with a resolution higher than 1280x1024 though. Images are also not restrained to the width of the column because of max-width. But the extra image is hidden, rather than breaking the layout.
Because it's all based off percentages, the gutters vary in size. But at full width the gutters are about 40px wide.
If an image is smaller than the column it is contained in, it will be displayed at its original size. If it is larger then it will be shrunk to the width of the column. Don't define height and width of images inline, it'll break the proportions if they're scaled down.
<div class="container"> <div class="row"> <div class="threecol"> <p>Column 1</p> </div> <div class="threecol"> <p>Column 2</p> </div> <div class="threecol"> <p>Column 3</p> </div> <div class="threecol last"> <p>Column 4</p> </div> </div> </div>
.container
Is a full width div that allows layouts to have a background that spans the full width of the browser. It also contains 20px padding on either side to keep content away from the edges when it becomes fluid. You can just use one big container, or use multiple to break the page horizontally.
.row
Is a row of columns. It centres them and defines the 1140px max-width.
.onecol, .twocol, .threecol, .fourcol, .fivecol, .sixcol, .sevencol, .eightcol, .ninecol, .tencol, .elevencol, .twelvecol
Are the classes for each column. They can be used in any combination within a row that adds up to twelve or less.
.last
The last column within a row also needs this class. It removes the right margin so all the columns fit within the row.
Restored by Digital Design Agency
See more: UI UX | Branding | App Development