Skip to content

Modernizr – get fine grained control over your CSS

Modern web browsers like Safari, Chrome and Firefox support some extremely useful parts of the CSS3 specification, that can remove a great deal of the pain of creating simple things like rounded corners, drop shadows, and gradients. However, the elephant in the room is still Internet Explorer, and particularly that god-awful aberration called IE6. So how can you easily take advantage of these new CSS attributes in browsers that support it, but without interfering with legacy browsers like IE?

Modernizr is a lightweight JavaScrpt library that identifies those CSS attributes that the client’s browser supports, then makes those easy to access by adding their names as CSS classes to the <html> tag, or as object properties in JavaScript. This means you can easily create CSS rules that are only used by supported browsers or make decisions within JavaScript to conditionally do things.

.borderradius ul li a { //do stuff}

if(Modernizr.fontface == false) {do stuff};

This entry was posted in Web Development and tagged , , . Bookmark the permalink.

Comments

Sorry, comments are closed on this page.