Modernizr. Using it makes you suck less.

Modernizr is a must if you’re developing websites. If you haven’t been using it, then you suck. But you didn’t know any better and you can change that.

I find myself avoiding JavaScript libraries and sticking to old school JavaScript as much as I can – there are just some times that it weighs more than it needs to relative to the type of site. But the one piece of code that I’ll always use on a site is this!

Just yesterday they released Modernizr 2 beta that allows you to roll-your-own download. It’s a beautiful thing.

Simply put, Modernizr does just a few things:

To explain a little further, when Modernizr fires off it will add a class to your html tag like “.js” and “.video” that allows you to easily specify different styles for different delivery:

.js ul {
     // If JavaScript is working, give it this style
}
.no-js ul {
     // If there isn't any JavaScript, style it like this instead
}

See? Isn’t that fun and easy?

And for the JavaScript code, you can get test a certain feature:

if (Modernizr.canvas) {
     // Make some awesome Canvas Stuff
}
else {
     //Tell the user that they suck for not having a great browser 
and maybe be nice and put in some real content
}

So that’s really it – It will make your life easier and thanks to the new Beta, you’ll also be able to keep the code as slim as you need it.