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

CSS3 With a Safety Net

CSS3 With a Safety Net

Techniques to use CSS3 today while accommodating all browsers. Presented at SudWeb 2012 on 25th May in Toulouse, France. #sudweb

Peter Gasston

May 26, 2012
Tweet

More Decks by Peter Gasston

Other Decks in Programming

Transcript

  1. LES GASSTONS Because I’m part French myself. My family came

    over with the Normans in 1066. So any jokes I make will be done with a sense of fraternité.
  2. ~77% OF BROWSERS HAVE CSS3 SUPPORT TO SOME DEGREE Source:

    Statcounter The point when every browser fully supports CSS3 may be very far into the future, or not at all.
  3. e { background-color: #FF64C1; background-image: linear- gradient(#FF64C1,#FF049B); border-radius: 5px; }

    This means some elements will display differently cross-browser. But, as we say in English....
  4. YOU MAY BE WORRIED THAT YOUR CLIENT WON’T ACCEPT THAT

    I know Sarkozy isn’t president any more, but there are no images of Hollande dressed as Napolean. Also, is it okay to make jokes about Napoleon in France?
  5. A metaphor for progressive enhancement: everybody gets the croissant, but

    some get the croissant au jambon et fromage. (In England I use biscuits in this metaphor).
  6. DO SOMETHING Add a little extra code to make sure

    that non-CSS3 browsers still get a good experience, like using a background-image as well as gradients.
  7. REWARD PEOPLE WITH GOOD BROWSERS DO COOL STUFF It means

    extra work, so why bother doing it? You get to learn new things, and your users with modern browsers get a better experience.
  8. You may have to convince your designers about progressive enhancement

    Because bad designers insist on pixel-perfection cross-platform. If so...
  9. $.support.transition=(function(){ var aBody=document.body|| document.documentElement; var aStyle=aBody.style; var support= aStyle.transition!==undefined|| aStyle.WebkitTransition!==

    undefined||aStyle.MozTransition!== undefined||aStyle.MsTransition!== undefined||aStyle.OTransition!== undefined; return support; }
  10. FOR EMERGENCIES ONLY Polyfills etc, bring performance problems, so use

    them with caution and only if you really must.