Modernizr: start implementing CSS 3 and HTML5 features now
So, you're a web designer, and you want to start taking advantage of new features in CSS 3 and HTML5. That's great, but you know that most of your users aren't running browsers that support these new standards. You could just wait for browsers to get with the times, or you could check out Modernizr.
Modernizr is a JavaScript library by Faruk Ates that detects which functionality a browser can support, and allows you to use if-statements to fine-tune your fallbacks for browsers that don't support the new hotness. Modernizr can't fix old browsers, but it can make it more practical to support newer ones. On top of all the CSS 3 styles it can detect support for, it also allows you to use and style HTML5 elements without breaking your site for IE users. Not too shabby for a little bit of JavaScript.













Comments
5
Subscribe to commentschesamaJul 3rd 2009 11:57AM
i wonder how much of this is extraneous stuff that you couldn't get via a homebrew version.
sRcJul 3rd 2009 1:15PM
not open beta participants, no
sRcJul 3rd 2009 1:16PM
wait, crap, howd that end up in this article?
Matias KorhonenJul 3rd 2009 5:33PM
Seeing as neither HTML5 nor CSS3 are finished yet I'd hold off before implementing too much in them. Especially if you like your CSS and HTML to validate properly.
Faruk AteşJul 4th 2009 12:55AM
@chesama:
Modernizr only takes a couple of milliseconds to run (the goal was to keep it below 20ms on your average computer of today), so the "extraneous stuff" is pretty minimal. Also, the library is only 6kb in compressed form, so that's not much of a reason to try and cut pieces out.
@Matias:
First of all, the reason you should use HTML5 and CSS3 is precisely _because_ they're not finished yet. That way, you can give the spec writers and the browser vendors crucial feedback. Otherwise, you're just being passive and not helping the Web move forward (this is also why they have the vendor prefixes).
Secondly, validation is not a goal to strive towards. It is a tool, useful to help you debug issues in browsers. If you strive for validation, you're not doing it right: you should always strive for good user experiences, high maintainability and great performance. Validation can help get you there, but in and of itself it is an utterly worthless goal to have.