Okay, this was kicked off by a deviation in this thread, where jaguarz asked this:
At some point, a suggestion was made:
A CSS Framework is a sort of set of pre-written CSS instructions (a library) that developers can use to “plug in” and start whipping out sites at a faster pace. It may come with things like a CSS reset (what is a “CSS reset”? Let me Google that for you), “default” containers that are commonly used (setups like a centered main container with one or two sidebars, main content and a footer for example), and chunks of seemingly random code whose purpose is to have the developer start out fairly cross-browser (depending on the setup this may be something like a separate IE stylesheet where [url=http://www.satzansatz.de/cssd/onhavinglayout.html]Haslayout is triggered on many elements, or clearing classes in anticipation of floats, etc).
Frameworks are getting very popular and I’m often mixing them up with CMS’ (like Drupal which is both a framework in the usual sense and also a Content Management System) which often have a lot of characteristics of CSS frameworks (esp since they are based on templating systems) and something called “OOCSS”.
No, that’s not a joke. Object-oriented CSS. Yes, CSS is NOT a programming language. Yes, CSS does not actually have objects, object classes, or object inheritance… but there are people who like the idea of “code reuse” as you have with Object Oriented programming (make objects (chunks of code or data) with certain properties and use variations of them all over the place instead of writing new, specific bits of code for everything). CSS does have inheritance and the Cascade; however the point of OOCSS is to make these reusable bits of CSS code “location independent”. I’m of two minds about that: I use location to reduce my code often, trying to let the defaults and container settings trickle through as much as possible. But this may simply be the Wrong Way with something like a template where users can move boxes around anywhere on the page.
To me, the result is messy, bloated HTML. Both with regular HTML template frameworks like Drupal and actual CSS frameworks, you get a lot of nonsensical-sounding class names, classitis, divitis, and 15 containers for a single line of text. Okay I’m exaggerating, 5 containers for a logo.
<body id="page_bg" class="color_green bg_green width_fmax">
<a name="up" id="up"></a>
<div class="center" align="center">
<div id="wrapper">
<div id="wrapper_r">
<div id="header">
<div id="header_l">
<div id="header_r">
<div id="logo"></div>
</div>
</div>
</div>
<div id="tabarea">
<div id="tabarea_l">
<div id="tabarea_r">
<div id="tabmenu">
<table cellpadding="0" cellspacing="0" class="pill">
<tr>
<td class="pill_l"> </td>
<td class="pill_m">
<div id="pillmenu">
</div>
</td>
<td class="pill_r"> </td>
</tr>
</table>
</div>
</div>
</div>
</div>
...
(that’s from a Joomla page used by a guy with a nice little site who does not write HTML or CSS himself… it is not a page using any particular CSS framework, but is a template which, regarding CSS, does share a lot of characteristics with css frameworks).
I really would hide my head in shame if any site of mine had that. I don’t care that it might be faster to get a site in the air (and I’m lucky I don’t have clients or bosses that insist on such things… and I realise not everyone has that luxury); that’s just… disgusting. Ew! Ew! Kill it with fire!
The Web Standards Evangelical Movement has been working hard for the last decade trying to get the web… semantic. Not only meaning from HTML tags themselves (with 91 elements, a bunch of them totally not relevant to 90% of web pages, this often means there isn’t quite the right element for the data you’re marking up) but also with id and class names. This is partially for developers, to help them remember the meanings. <div class=“a”> or <span class=“span-14”> means a lot less than <div class=“sidebar”> or <span class=“logofont”>.
However, this is seen by many as a sort of “dream” or HTML Utopia that, while nice to try for and certainly a goal for developers, in the real world, when both robots (templates) and non-technical users (clients who ordered a website from you, blogs, visitor comments, …all of which often easily make carefully crafted code invalid quickly) are manipulating web pages, is simple Not Practical.
When developing a template, for which you have no idea what the end users will determine which content goes in what box, it’s damn near impossible to know what’s going in span-14, but for your users you’re going to give it a style they can choose based on how they want the page to look like.
I thought the comments on Jeff Croft’s article here were terribly interesting (as with many bloggities, the comments are often more valuable than the article alone). What kind of a class name could you possibly come up with for a blue box who always sits on the lower-right-hand side? You have no clue what it will hold, you only know its presentation.
Or, you need to develope a bunch of sites quickly (one of the reasons BluePrint was created… like jQuery for Javascript, developers found themselves rewriting the same code over and over again). Deadlines can be the enemy of valid, semantic code (not that this is a good excuse or anything but it’s how it is in the Real World), and having a decent starting point that at least is valid and works cross-browser can make a project possible.
The question for me isn’t whether people should use CSS frameworks. I personally don’t, but I don’t make websites as complicated as Drupal. My largest CSS file so far is 38kb and a total of 2038 lines (non-optimised, so whitespace included). I have the freedom to hand-code and I like to think I’m pretty fast at it. But my side also has control over the content. The boss, or visitors, simply aren’t allowed to add <font> tags.
There are professionals in the front-end who care about semantics and valid code and do use frameworks. In fact, css frameworks are mostly built by these people.
The question for me is, is a framework something css/web NEWBIES should start out with? Or even look at? Esp. newbies are are coming from the back end, or programming in general? (these would be the people who have the most trouble with CSS, in my opinion).
Stubbornella (Nicole Sullivan-Haas) says this:
Current methods for writing CSS require expert level ability just to get started. To become a CSS expert, you need to spend couple years coding away in your basement by yourself before you are remotely useful.
[ bold is hers; particular article is linked in her name above ]
This is partially the argument for the need for “OOCSS” (and frameworks as well)… that someone has to spend all this time learning CSS… I’d argue it’s pretty much the same in any programming language as well, and I believe if you DIDN’T spend years coding away in your basement before offering your code to the world, you don’t know what to do when something breaks, because instead of leaning French you learned the phrasebook via Babelfish. I don’t want more people running around in my profession who can say “the cheese is old and moldy, where is the bathroom” but don’t know how to say “the bathroom is old and moldy”.
Are newbies unnecessarily re-inventing the wheel when writing out their float clears and triggering Haslayout the first gazillion times? When some pre-written code they can just add will do it for them and they can concentrate on other things? This same question holds for Javascript libraries, really. At what point is someone able to say “This is not a black box doing my job, but a tool that simply makes my job faster”? My opinion is, if you want to learn the language, then learn it first, before engaging in things like libraries and frameworks.
Second, when we’re trying shove web semantics down newbies’ throats, is introducing them to class=“block clear-block block-clear clear-clear-block-clear-block” going backwards? Or is it the future as sites become simply too user-interactive (the users/visitors, not the web devs, are manipulating and adding the content of the sites)?
Are we encouraging bloat when presenting frameworks to newbies? I continue to see newbies and not-so-newbies using the Meyer CSS reset, or older versions of the reset, or the very similar Yahoo reset. Removing padding etc from deprecated elements, removing borders from elements who never have them to begin with, and the two that really bother me… removing outline from focussed elements with a cute little note afterwards telling people not to forget to add it back in (guess what? Just about everyone forgets) and the little note I keep seeing about how cellpadding or cellspacing is still necessary to add to tables in HTML. This might be from an older reset but I see it in brand-new pages. And if you don’t have any tables on the site? Yeah, one line of code isn’t going to break anyone’s modem or server, but why keep bloat? No, why introduce it in the first place?
Should visitors be downloading a stylesheet for resets, a main stylesheet, a typography stylesheet, an IE stylesheet (or three), and whatever else, just to visit a page? What about One GET Request To Rule Them All? (not that any framework would stop you from goobering all those separate styles together into one file, but sites seem to have several stylesheets because they started out that way)
Okay, rambling over, here are some links I ran into back when I first heard of these things, lawlz:
Basic intro, quick list of pros and cons, and then a seemingly exhaustive list of frameworks… really I’ve only heard of Blueprint, YUI, 960grid and the OOCSS…
http://www.w3avenue.com/2009/04/29/definitive-list-of-css-frameworks-pick-your-style/
Semantics and OOCSS? Or, CSS “macros”? Lord knows, among our wishlists for ponies and other css goodies, some of us have wanted variables.
http://memerocket.com/2009/03/28/oocss-sass-fewer-classes-on-your-elements/
Yeah, I called them abominations, mostly because I can. I do believe they are useful, valuable tools for many developers, and we all know visitors never look at a site’s underwear (only web devs do that). But I don’t want my code to look like that, be organised like that, and I don’t want newbies’ codes to smell like that, but I have the freedom to avoid framesets and not all newbies intend to learn CSS or front-end web development, but instead are just trying to get a decent page in the air for the boss.
Anyway I’d like this thread to be a collection of yea’s, nay’s, and examples of when you guys have used or considered CSS frameworks, OOCSS, and the like. What one did you use and why?