Html5 & Css3: A Practical Guide
Html5 & Css3: A Practical Guide
A Practical Guide
HTML5
Cons
Some work is needed to accommodate older browsers
Approaches
Modernizr Numerous polyfills
Modernizr
A minimal JavaScript solution (5k) that detects a browsers features
html5shiv
Turns HTML5 structural elements into HTML4 elements for older browsers <header> becomes <div id=header>
Cons
More complex preparation Can be tricky when embedding hosted videos (YouTube, Vimeo, etc.)
VideoJS
Builds on VFE
Uses JavaScript for a more consistent experience Falls back gracefully if JavaScript is disabled
FREE!
See http://videojs.com for details and downloads.
CSS3
Cons
Some work is needed to accommodate older browsers
Various Approaches
CSS3 + IE Filters PIE Selectivzr Modernizr eCSStender
CSS3 + IE Filters
Pure CSS solution with forks
background: #1E5799; /* old browsers */ background: -moz-linear-gradient(top, #1E5799 0%, #2989D8 50%, #207cca 51%, #7db9e8 100%); /* firefox */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1E5799), color-stop(50%,#2989D8), colorstop(51%,#207cca), color-stop(100%,#7db9e8)); /* webkit */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1E5799', endColorstr='#7db9e8',GradientType=0 ); /* ie */
At a Glance
Selector
CSS3 + IE Filter No
Decoration
Yes
File Size
?
Notes
PIE
A JavaScript solution that uses IE specific behavior that is applied via HTML Components (HTC). Limited feature support:
border-radius box-shadow linear-gradient
At a Glance
Selector
CSS3 + IE Filter PIE No No
Decoration
Yes Limited
File Size
? 11K
Notes
IE Only
Selectivizr
A JavaScript solution that emulates CSS3 pseudo-class and attribute selectors in IE 6-8
At a Glance
Selector
CSS3 + IE Filter PIE Selectivzr No No Yes
Decoration
Yes Limited No
File Size
? 11K 4K
Notes
IE Only IE Only
Modernizr
A JavaScript solution that detects user browsers features
At a Glance
Selector
CSS3 + IE Filter PIE Selectivzr No No Yes
Decoration
Yes Limited No
File Size
N/A 11K 4K
Notes
IE Only IE Only
Modernizr
No
No
5K
eCSStender
A JavaScript solution that dynamically writes CSS to support older browsers. Core is (20k), Extensions are additional (tiny)files to download. Only download the extensions that you want.
At a Glance
Selector
CSS3 + IE Filter PIE Selectivzr No No Yes
Decoration
Yes Limited No
File Size
N/A 11K 4K
Notes
Pure CSS IE Only IE Only
Modernizr
eCSStender
No
Yes
No
Limited
5K
20K+
@font-face
Web fonts
Allows a page to use fonts not installed on a users computer @font-face first specd in CSS2 Resistance from font designers made it unworkable Designers and services now working together to make fonts available
Cons
Added page size More creative typography Rendering differences make testing a must
Hosted solutions
Typekit, Monotype, etc. Low set up difficulty Excellent compatibility: IE4+, Firefox 3.5+, Safari 3.1+, Opera 10+, Chrome 4+ Great selection, no licensing issues Javascript file required, dependence on 3rd party Recurring payments required upper tiers
Serving locally
Good selection from Font Squirrel, League of Moveable Type, etc. Moderate set up difficulty Excellent compatibility: IE4+, Firefox 3.5+, Safari 3.1+, Opera 10+, Chrome 4+, iOS No JavaScript required Using your own desktop fonts probably violates the license
Take Away
Dont be afraid to provide the HTML5 experience today
HTML5 CSS3 Web fonts JS