I’ve recently invested a great deal of time investigating the full immediate potential of HTML5, CSS3, among other technologies for web sites and mobile sites/apps a like.
One thing that became abundantly clear was the need to fully detect browsers feature capabilities to provide a rich user experience for users without neglecting half the market, I.e. progressive enhancement.
On looking around for a solution I came across Modernizr, a JavaScript library that “adds classes to the <html> element which allow you to target specific browser functionality in your stylesheet. You don’t actually need to write any JavaScript to use it.”
For example:
“Have you ever wanted to do if-statements in your CSS for the availability of cool features like border-radius? Well, with Modernizr you can accomplish just that! The syntax is very intuitive, too:”
/* properties for browsers that
support multiple backgrounds */
}
/* optional fallback properties
for browsers that don’t */
}
This library could open the door to greater level of adoption of the HTML5 and CSS 3 standards allowing developers more creative freedom and confidence with the work they produce knowing that they can ensure a wide coverage of their sites functionality.
Modernizr currently detects support for the following:
- @font-face
- Canvas
- Canvas Text
- HTML5 Audio
- HTML5 Video
- rgba()
- hsla()
- border-image:
- border-radius:
- box-shadow:
- opacity:
- Multiple backgrounds
- CSS Animations
- CSS Columns
- CSS Gradients
- CSS Reflections
- CSS 2D Transforms
- CSS 3D Transforms
- CSS Transitions
- Geolocation API
- localStorage
- sessionStorage
- SVG
- SMIL
- SVG Clipping
- Drag and Drop
- hashchange
- X-window Messaging
- History Management
- applicationCache
- Web Sockets
- Web Workers
- Web SQL Database
- IndexedDB
- Input Types
- Input Attributes
This library should definitely be high on your list of libraries to consider whilst undertaking a project, definitely worth a play at the very least.
Have a look at Modernizr browser feature detection (Progressive Enhancement)
Why not also check out this Modrenizr tutorial