WWYUIGD? Two Guidelines for Writing Hell's Best CSS
WWYUIGD (What would Yahoo User Interface Grids Do?) is defined as two things:
- Exaggerating a good idea to such ridiculous proportions that it becomes a bad idea.
- The duel guidelines that anyone can use to write hell's best CSS
Guideline One: Meaningless numbers are great
The .yui-t(x) set of classes offer powerful control over sidebar widths, and positions. Indeed, so powerful that the classes themselves offer neither clue, nor an understandable pattern.
- .yui-t1: 160 on left
- .yui-t2: 180 on left
- .yui-t3: 300 on left
- .yui-t4: 180 on right
- .yui-t5: 240 on right
- .yui-t6: 300 on right
- .yui-t7: One full width column
If Yahoo was full of sissies, they would have made this system semi easy to remember by using this pattern:
.yui-t-[sidebar position (options are l, r)]-[sidebar size (options are s,m,l)].
Once you remembered that ".yui-t-r-m" would cause the template to have a right sidebar of 180px, you'd also remember what .yui-t-l-s (left sidebar, 160px) meant. That would clearly violates the WWYUIGD philosophy as it doesn't require cheatsheets or flashcards.
Guideline Two: Words bad, Acronyms Good, Meaningless Letters Best
Acronyms are great for saving trace amounts of bandwidth, and confusing yourself for hours. Again YUI Grids are the industry leader in word hating. Not only to they is there not a single complete word in the css -- the letters themselves don't mean anything!
Check out the nesting grids classes (1/2, 1/2 == two columns of equal width).
- .yui-g 1/2, 1/2
- .yui-gb 1/3, 1/3, 1/3
- .yui-gc 2/3, 1/3
- .yui-gd 1/3, 2/3
- .yui-ge 3/4, 1/4
- .yui-gf 1/4, 3/4
The danger using words, and non-arbitrary numbers can be seen below:
God forbid systems that let you learn one pattern vs 6 numeric IDs.
All in all, yahoo grids is actually great invention. Pity that it had to be ruined by something as small as the names of its classes.