YUI grids extension

Written at 17:45, on Tuesday 11 September 2007. Tags: webdesign .

Despite the extra required <div> tags, I regularly use the Yahoo! UI grids framework. This provides several advantages when buidling multi-column layouts with CSS. Besides speedy development and source-order independence, it gives you a lot of flexibility when creating your site. More practically, it's extensively tested in A-grade browsers which includes the ancient, but still widely used Internet Explorer 6). Lastly, they're almost completely driven by classes, which means you can add your own, semantically chosen, id's.

The default widths provided can be used for pixel-precise layouts while maintaining font-size based scaling, but there's one curious thing about the default grids that has always bothered me. For the left sidebar, they provide widths of 160px, 180px and 300px, while for the right sidebar, they provide 180px, 240px and 300px. This asymmetry has bothered me long enough, so I whipped up some code for two additional sidebar configurations: the left 240px sidebar, and the right 160px sidebar.

You should be able to add the following code to any release of the grids.css:


/* yui-t8: 240 on left */
.yui-t8 #yui-main {
  float: right;
  margin-left: -25em;
}

.yui-t8 .yui-b {
  float: left;
  width:18.4608em;
  *width:18.016em;
}

.yui-t8 #yui-main .yui-b {
  margin-left:19.4608em; 
  *margin-left:19.016em;
}

/* yui-t9: 160 on right */

.yui-t9 #yui-main {
  float: left;
  margin-right: -25em; 
}

.yui-t9 .yui-b {
  float:right;
  width:12.3207em;
  *width:12.0106em;
}

.yui-t9 #yui-main .yui-b {
  margin-right: 13.3207em;
   *margin-right:13.0106em;
}

I tested them in the major browsers and it seems to work really well (it would really surprise me if they didn't, since I used the exact same measurements as in .yui-t1 and .yui-t5).

Add comment. (5 total) |

5 Comments so far

This is great. Thanks for sharing them.

The “preset templates” we offered initially were ones determined to be used most commonly after we audited most of our (y!) sites, and other sites. But I do agree with you that the asymmetry is strange. I think I’ll probably include the rest of the permutations in the next release of YUI Grids.

Thanks again,
Nate

It would be great if these presets would be included next release, thanks!

Jeroen Coumans on

It would also be great if Yahoo provided a way to “zero out” the margins between columns. From a visual design perspective that would be great addition to an already great framework.

Well done!

Hey,
Nice addition to YUI, I was using it initially, then decided I actually need something like 210px on left side… Could you please tell me how to do that? I mean, what calculations I need to do with ems etc.?

Romasito! on

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You can use Textile markup to format text.
  • SmartyPants will translate ASCII punctuation characters into “smart” typographic punctuation HTML entities.
  • Insert Flickr images: [flickr-photo:id=230452326,size=s] or [flickr-photoset:id=72157594262419167,size=m].
  • Web page addresses and e-mail addresses turn into links automatically.

From the portfolio

  • Musicminutes Cycle Systems Group landingspage

About this website

My name is Jeroen Coumans, I'm a freelance web designer, front-end developer and Drupal ninja from the Netherlands. I love to create beautiful, usable and accessible websites. On this website, you can find my portfolio as well as my personal weblog. Interested in hiring me? I'd love to hear from you.

After completing my BA in Arts and Culture I'm now doing a MA in Communication and Multimedia Design. More …

Elsewhere

Script to update Drupal teasers | be fused

"One of the annoying things about changing the number of characters for teasers in Drupal is that you have to edit and save every single node (page, story etc) for the change to take effect. Well, it doesn't have to be that difficult, because here is a nice little script that will update all of the teasers at once."

Add comment | Visit site …

Degrading Script Tags

Reducing the number of tags required for loading an external javascript library by combining them into one tag. "Only one tag – and the semantics would work like this: The external script would attempt to be loaded (as normal). If the load and execution was error-free then the internal script would be executed as well. If the load or execution failed then the internal script would not be executed. "

Add comment | Visit site …

Aurora: What Is Internet’s Atomic Level?

"For Aurora we saw an opportunity to change the browser’s focus from the page to the individual “object”. Giving users the ability to interact directly with the atomic parts of a given web page offered greater personalization of their Internet experience. " This has interesting repercusions for webdesign as well.

Add comment | Visit site …

The Joker Action Figure

These toys set a new bar for realism.

Add comment | Visit site …

Google Chrome Process Manager

John Resig, jQuery creator & Mozilla hacker, writes about the significance of the process manager in Google Chrome: "The blame of bad performance or memory consumption no longer lies with the browser but with the site."

Add comment | Visit site …

Surface: een Natural User Interface

(dutch) An overview of the Natural User Interface, a term coined by Microsoft for their Surface concept.

Add comment | Visit site …

Official Google Blog: A fresh take on the browser

Should be released any time now, curious if the screenshots in the comic are like the browser.

Add comment | Visit site …

Mozilla Labs » Introducing Ubiquity

Ubiquity is "experiment into connecting the Web with language in an attempt to find new user interfaces that could make it possible for everyone to do common Web tasks more quickly and easily." A command-line for the web, connecting services through a hotkey.

Add comment | (1 comments) Visit site …

Mariët Ruiter 3150801: Kritische literatuursynopsis

Critical comparison of mine and Selwyn's vision on the Digital Divide.

Add comment | Visit site …

IEBlog : Internet Explorer 8 Beta 2 Now Available

Will Microsoft make new virtual machines available for testing purposes? I hate buying another Windows license just to get my testing setup of IE6, IE7 and IE8 complete…

Add comment | Visit site …

Subscribe

Or choose one of the single feeds:
Journal feed | Elsewhere feed