Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Graceful Degradation with Modernizr

Lean Machine
September 05, 2013

Graceful Degradation with Modernizr

Lean Machine

September 05, 2013
Tweet

More Decks by Lean Machine

Other Decks in Programming

Transcript

  1. if (browser == 'IE8') { // Add some css classes,

    etc. } if (browser == 'IE9') { // Add some css classes, etc. } if (browser == 'IE10') { // Add some css classes, etc. } if (browser == 'IE11') { // Add some css classes, etc. } if (browser == 'Chrome') { // Add some css classes, etc. } if (browser == 'Firefox') { // Add some css classes, etc. }
  2. if (browser == 'IE8') { // Add some css classes,

    etc. } if (browser == 'IE9') { // Add some css classes, etc. } if (browser == 'IE10') { // Add some css classes, etc. } if (browser == 'IE11') { // Add some css classes, etc. } if (browser == 'Chrome') { // Add some css classes, etc. } if (browser == 'Firefox') { // Add some css classes, etc. }
  3. 1 HTML5 Shiv – Makes new HTML5 sectioning tags work

    in old browsers 2 CSS classes on <html> element based on available features 3 Modernizr.<feature> in JavaScript
  4. .our-div { -webkit-box-shadow: #666 1px 1px 1px; -moz-box-shadow: #666 1px

    1px 1px; box-shadow: #666 1px 1px 1px; } .no-boxshadow .our-div { border-bottom: 1px solid #666; border-right: 1px solid #777; }