SlideShare una empresa de Scribd logo
1 de 60
Descargar para leer sin conexión
CSS3 and HTML5


                          Does now really
                              mean now?
Saturday, 10 March 2012
Hi! I’m Chris Mills
     ‣ Open standards advocate and education agitator
      ‣ dev.opera.com editor
      ‣ W3C web education community group chair
     ‣ Accessibility whiner
     ‣ HTML5/CSS3 wrangler
     ‣ Heavy metal drummer & proud dad

Saturday, 10 March 2012
Saturday, 10 March 2012
cmills@opera.com
                                @chrisdavidmills
                    http://www.slideshare.net/chrisdavidmills
                              http://dev.opera.com
                     http://www.w3.org/community/webed/



Saturday, 10 March 2012
What we’ll talk about
     ‣ Do you really need The Shiny™?
     ‣ Progressively enhance, don’t rely on it
     ‣ When progressive enhancement isn’t viable,
       provide alternatives, use feature detection...
     ‣ ...use polyfills/shims
     ‣ #sxsw #dnrmn (lol, lmao, wtf, etc.)

Saturday, 10 March 2012
Saturday, 10 March 2012
Do you need it at all?



Saturday, 10 March 2012
Saturday, 10 March 2012
Saturday, 10 March 2012
Saturday, 10 March 2012
Saturday, 10 March 2012
HTML5 and CSS3 are fun
     ‣ But just because you can use them doesn’t mean
       you have to use them. All the bloody time!
     ‣ In the real world, with real clients, you are likely to
       have less freedom




Saturday, 10 March 2012
Do you need it?




Saturday, 10 March 2012
If you are going to use
                             prefixed CSS/JS...
     background: -webkit-linear-gradient(#ff0000,
                                         #000000);
     background: -moz-linear-gradient(#ff0000,
                                      #000000);
     background: -ms-linear-gradient(#ff0000,
                                     #000000);
     background: -o-linear-gradient(#ff0000,
                                    #000000);
     background: linear-gradient(#ff0000, #000000);


Saturday, 10 March 2012
Progressive
    enhancement


Saturday, 10 March 2012
Don’t rely on The Shiny™
     ‣ If *at all possible*
     ‣ Build a base level of functionality that works
     ‣ Then enhance the user experience




Saturday, 10 March 2012
Example: Ajax
     ‣ Ajax makes data updates more responsive
     ‣ But the base functionality could still work with no
       Ajax
     ‣ Albeit with page reloads



Saturday, 10 March 2012
Example: Offline apps
     ‣ Using apps offline is awesome
     ‣ But you’re probably not losing anything if your
       browser doesn’t support this
     ‣ http://dev.opera.com/articles/view/taking-your-
       web-apps-offline-web-storage-appcache-
       websql/


Saturday, 10 March 2012
Example: CSS3 bling
     ‣ Content looks a lot nicer in supporting browsers
     ‣ Also more flexible than using old graphical
       methods
     ‣ But the content should still be accessible in older
       browsers
     ‣ http://www.alistapart.com/articles/css3-bling-in-
       the-real-world/

Saturday, 10 March 2012
Example: CSS animation
     ‣ If done properly, a lot of CSS animations and
       transitions can be used unobtrusively
     ‣ For example, by default the element is set to be
       in its usable state, but then the animation is
       applied over the top to bring the animation to that
       state



Saturday, 10 March 2012
Example: Media queries
     ‣ One of the obvious ones!
     ‣ If media queries are not supported, the browser
       ignores them, and you get the standard layout
     ‣ Of course, this can be a problem if you are using
       the “mobile first” approach




Saturday, 10 March 2012
Example: Web fonts
     ‣ This is a perfect feature to use now!
     ‣ IE has supported EOT since IE4/5!
     ‣ You can use the bulletproof web font syntax - see
          fontsquirrel.com




Saturday, 10 March 2012
This is all fine...
     ‣ So long as your boss/client is cool with that!
     ‣ Many still obsess over identical layouts/
          functionality across browsers




Saturday, 10 March 2012
Identical layout/functionality
                       obsession
     ‣ A thing of the past?
     ‣ It is becoming much less of an issue, with so
       many different browsing platforms and devices
       now available
     ‣ Many different contexts require different layouts/
       functionality for a good user experience


Saturday, 10 March 2012
Acceptable
    alternatives
Saturday, 10 March 2012
Ok, sometimes progressive
  enhancement isn’t really possible
     ‣ <img>!
     ‣ <canvas>/WebGL
     ‣ <video>
     ‣ Web sockets
     ‣ etc.


Saturday, 10 March 2012
Fallbacks often a good option
     ‣ Equivalence of service
     ‣ Useful for multiple user groups
     ‣ As long as they can access the content and
          services in some way, you should be ok




Saturday, 10 March 2012
HTML5 <video>
     ‣ Typical example of HTML5’s attitude to fallback




Saturday, 10 March 2012
HTML5 <video>
     <video controls>
       <source src="video-file.mp4"
               type="video/mp4">
       <source src="video-file.webm"
               type="video/webm">
       <track src="en.vtt" kind="subtitles"
              srclang="en" label="English subtitles">
       <!-- Flash player often referenced in here: will
     play the MP4 version of the video -->
     </video>

Saturday, 10 March 2012
Flash fallbacks viable
     ‣ Might seem annoying to have to implement, but
       once you’ve got a template, you’re off.
     ‣ And Flash can just load the MP4 version of the
       video
     ‣ Also consider jPlayer, Sublime, etc.


Saturday, 10 March 2012
Unfortunately...
     ‣ The fallback content is for browsers that don’t
       support <video>
     ‣ Not for browsers that don’t support the format
       being offered up
     ‣ You’ll need multiple formats for the time being


Saturday, 10 March 2012
What about when alternative
            mechanisms don’t exist?
     ‣ Make your own!
      ‣ Use feature detection
      ‣ Basic tests, or a library like Modernizr




Saturday, 10 March 2012
Feature detection basics
     if (window.chrome) {
       // do stuff that works on Chrome
     }
     else {
       // ignore it, and do something else
     }




Saturday, 10 March 2012
Feature detection basics
     if (checkVideo()===true) {
       // do stuff that uses this method
     }
     else {
       // ignore it, and do something else
     }




Saturday, 10 March 2012
Modernizr
     ‣ The mother of all feature detection libraries
     ‣ Available at modernizr.com




Saturday, 10 March 2012
Modernizr CSS example
     <html lang="en-US" class="no-js">
     <head>
       ...
     <script src="modernizr.js"></script>
       ...
     </head>




Saturday, 10 March 2012
Modernizr CSS example
     <html class=" js flexbox canvas canvastext webgl no-
     touch geolocation postmessage no-websqldatabase
     indexeddb hashchange history draganddrop websockets
     rgba hsla multiplebgs backgroundsize borderimage
     borderradius boxshadow textshadow opacity
     cssanimations csscolumns cssgradients no-
     cssreflections csstransforms no-csstransforms3d
     csstransitions fontface generatedcontent video audio
     localstorage no-sessionstorage webworkers
     applicationcache svg inlinesvg smil svgclippaths"
     lang="en-US">

Saturday, 10 March 2012
Modernizr CSS example
     #wrapper:hover, #wrapper:focus {
       transform: rotateX(180deg);
     }




Saturday, 10 March 2012
Modernizr CSS example
     .no-csstransforms3d #wrapper #front {
       transition: 0.8s all ease-in;
     }

     .no-csstransforms3d #wrapper:hover #front,
     .no-csstransforms3d #wrapper:focus #front {
       transform: rotate(-30deg) translate(-50%,-100%);
     }




Saturday, 10 March 2012
Modernizr JS example
     function rotateForm() {
       if(Modernizr.cssanimations) {
         form.setAttribute("class","form-rotate");
         form.style.left = "0rem";
       } else {
         back.style.zIndex = "5";
       };
     };


Saturday, 10 March 2012
In general, Modernizr rocks
     ‣ It can add a fair bit of weight to your page: 49KB
       for the full library
     ‣ But you can create a smaller custom version that
       just includes the tests you need
     ‣ There are some things that can’t be detected


Saturday, 10 March 2012
IE conditional comments
     <!--[if lte IE 8]>
       <link rel="stylesheet"        href="iefixes.css"
     type="text/css">
     <![endif]-->
     <!--[if lte IE 6]>
       <link rel="stylesheet"        href="ie6.css" type="text/
     css">
         <![endif]-->



Saturday, 10 March 2012
Polyfills/shims



Saturday, 10 March 2012
Add in support where needed
     ‣ Using JavaScript
     ‣ Fake SVG in old IE versions using VML
     ‣ Fake box-shadow using IE filters (although they
          are evil — every time you use IE filters, god kills a
          kitten)



Saturday, 10 March 2012
Adding HTML5 support to
                                 browsers
     ‣ Older browsers don’t support them!
     ‣ But you can style any unknown element, so just
       set all the “block level” elements to display as
       block, at the top of your CSS:
     ‣ article { display: block; }


Saturday, 10 March 2012
Oh, but IE 6-8 need
                           some more help
     ‣ They refuse to style unknown elements, unless
       you create instances of them in the DOM
     ‣ document.createElement('article');




Saturday, 10 March 2012
CSS3 PIE for CSS bling support
     ‣ http://css3pie.com/
     ‣ Awesome little library
     ‣ Add support to IE6-8 for box-shadow, border-
          radius, gradients and transparent colours
     ‣ But not text-shadow, which is a little frustrating


Saturday, 10 March 2012
CSS3-mediaqueries.js
     ‣ http://code.google.com/p/css3-mediaqueries-js/
     ‣ Add media queries support to IE
     ‣ A bit clunky, when you resize, but it works




Saturday, 10 March 2012
Excanvas
     ‣ http://excanvas.sourceforge.net/
     ‣ Add <canvas> support to IE




Saturday, 10 March 2012
Selectivizr
     ‣ http://selectivizr.com/
     ‣ Adds support for CSS3 selectors to IE6-8




Saturday, 10 March 2012
All sounds good, huh?
     ‣ Beware: slows down loading!
     ‣ Especially stuff that makes use of IE filters
     ‣ Can be mitigated by helpers such as YepNope




Saturday, 10 March 2012
To summarise



Saturday, 10 March 2012
Does now really mean now?




Saturday, 10 March 2012
Progressive enhancement and
                  alternatives
     ‣ Can be successful
     ‣ But not everything is easy to provide for
     ‣ And your clients might not approve




Saturday, 10 March 2012
Polyfills
     ‣ Are great
     ‣ But complicate things
     ‣ And give a performance hit




Saturday, 10 March 2012
Think carefully
     ‣ Do you need to do it this way?
     ‣ Is there viable alternative content that can be
          provided, or different ways to implement it?




Saturday, 10 March 2012
It will be a while before
                              things get easier




Saturday, 10 March 2012
More resources
     ‣ html5please.com
     ‣ caniuse.com
     ‣ Practical CSS3: design and develop (Peachpit
          Press, August 2012ish)




Saturday, 10 March 2012
Thanks!
                               cmills@opera.com
                                @chrisdavidmills
                    http://www.slideshare.net/chrisdavidmills
                              http://dev.opera.com
                     http://www.w3.org/community/webed/



Saturday, 10 March 2012
Thank you CC!
                Spidermen — http://www.flickr.com/photos/ralphman/792848885/
        Schoolkids — http://www.flickr.com/photos/mallalamuseum/3838470381/
         Old married couple — http://www.flickr.com/photos/adwriter/257937032/
                                  No IE6 — http://www.navegabem.com
              Parrot — http://www.flickr.com/photos/young-in-panama/57895100/
                          Immortal — 10 most ridiculous black metal photos ever




Saturday, 10 March 2012

Más contenido relacionado

La actualidad más candente

jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPages
Mark Roden
 
Responsive Web Design with HTML5 and CSS3
Responsive Web Design with HTML5 and CSS3Responsive Web Design with HTML5 and CSS3
Responsive Web Design with HTML5 and CSS3
Kannika Kong
 

La actualidad más candente (20)

"Responsive Web Design: Clever Tips and Techniques". Vitaly Friedman, Smashin...
"Responsive Web Design: Clever Tips and Techniques". Vitaly Friedman, Smashin..."Responsive Web Design: Clever Tips and Techniques". Vitaly Friedman, Smashin...
"Responsive Web Design: Clever Tips and Techniques". Vitaly Friedman, Smashin...
 
jQuery Comes to XPages
jQuery Comes to XPagesjQuery Comes to XPages
jQuery Comes to XPages
 
Html5
Html5Html5
Html5
 
Web Design Primer Sample - HTML CSS JS
Web Design Primer Sample - HTML CSS JSWeb Design Primer Sample - HTML CSS JS
Web Design Primer Sample - HTML CSS JS
 
State of jQuery June 2013 - Portland
State of jQuery June 2013 - PortlandState of jQuery June 2013 - Portland
State of jQuery June 2013 - Portland
 
Great Responsive-ability Web Design
Great Responsive-ability Web DesignGreat Responsive-ability Web Design
Great Responsive-ability Web Design
 
Using Web Standards to create Interactive Data Visualizations for the Web
Using Web Standards to create Interactive Data Visualizations for the WebUsing Web Standards to create Interactive Data Visualizations for the Web
Using Web Standards to create Interactive Data Visualizations for the Web
 
HTML5 Essential Training
HTML5 Essential TrainingHTML5 Essential Training
HTML5 Essential Training
 
CSS Grid Changes Everything - Keynote at WebCamp Zagreb 2017
CSS Grid Changes Everything - Keynote at WebCamp Zagreb 2017CSS Grid Changes Everything - Keynote at WebCamp Zagreb 2017
CSS Grid Changes Everything - Keynote at WebCamp Zagreb 2017
 
Google’s PRPL Web development pattern
Google’s PRPL Web development patternGoogle’s PRPL Web development pattern
Google’s PRPL Web development pattern
 
HTML5: An Overview
HTML5: An OverviewHTML5: An Overview
HTML5: An Overview
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPages
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPages
 
Front End Best Practices
Front End Best PracticesFront End Best Practices
Front End Best Practices
 
Advanced front end debugging with ms edge and ms tools
Advanced front end debugging with ms edge and ms toolsAdvanced front end debugging with ms edge and ms tools
Advanced front end debugging with ms edge and ms tools
 
Doing More with LESS for CSS
Doing More with LESS for CSSDoing More with LESS for CSS
Doing More with LESS for CSS
 
HTML5: An Introduction To Next Generation Web Development
HTML5: An Introduction To Next Generation Web DevelopmentHTML5: An Introduction To Next Generation Web Development
HTML5: An Introduction To Next Generation Web Development
 
Html5 Fit: Get Rid of Love Handles
Html5 Fit:  Get Rid of Love HandlesHtml5 Fit:  Get Rid of Love Handles
Html5 Fit: Get Rid of Love Handles
 
Take Your Markup to Eleven
Take Your Markup to ElevenTake Your Markup to Eleven
Take Your Markup to Eleven
 
Responsive Web Design with HTML5 and CSS3
Responsive Web Design with HTML5 and CSS3Responsive Web Design with HTML5 and CSS3
Responsive Web Design with HTML5 and CSS3
 

Similar a HTML5 and CSS3: does now really mean now?

Building Responsive Websites and Apps with Drupal
Building Responsive Websites and Apps with DrupalBuilding Responsive Websites and Apps with Drupal
Building Responsive Websites and Apps with Drupal
Four Kitchens
 
Is it time to start using HTML 5
Is it time to start using HTML 5Is it time to start using HTML 5
Is it time to start using HTML 5
Ravi Raj
 
Web development today
Web development todayWeb development today
Web development today
Jaydev Gajera
 

Similar a HTML5 and CSS3: does now really mean now? (20)

Angels versus demons: balancing shiny and inclusive
Angels versus demons: balancing shiny and inclusiveAngels versus demons: balancing shiny and inclusive
Angels versus demons: balancing shiny and inclusive
 
JSDay 2013 - Practical Responsive Web Design
JSDay 2013 - Practical Responsive Web DesignJSDay 2013 - Practical Responsive Web Design
JSDay 2013 - Practical Responsive Web Design
 
A Period of Transition
A Period of TransitionA Period of Transition
A Period of Transition
 
(For non-developers) HTML5: A richer web for everyone
(For non-developers) HTML5: A richer web for everyone(For non-developers) HTML5: A richer web for everyone
(For non-developers) HTML5: A richer web for everyone
 
Real solutions, no tricks
Real solutions, no tricksReal solutions, no tricks
Real solutions, no tricks
 
Echo HTML5
Echo HTML5Echo HTML5
Echo HTML5
 
Building Responsive Websites and Apps with Drupal
Building Responsive Websites and Apps with DrupalBuilding Responsive Websites and Apps with Drupal
Building Responsive Websites and Apps with Drupal
 
Html5 & less css
Html5 & less cssHtml5 & less css
Html5 & less css
 
What is HTML 5?
What is HTML 5?What is HTML 5?
What is HTML 5?
 
HTML5: A brave new world of markup
HTML5: A brave new world of markupHTML5: A brave new world of markup
HTML5: A brave new world of markup
 
Introduction to html 5
Introduction to html 5Introduction to html 5
Introduction to html 5
 
The W3C and the web design ecosystem
The W3C and the web design ecosystemThe W3C and the web design ecosystem
The W3C and the web design ecosystem
 
Is it time to start using HTML 5
Is it time to start using HTML 5Is it time to start using HTML 5
Is it time to start using HTML 5
 
Web development today
Web development todayWeb development today
Web development today
 
Frontend Performance: Illusions & browser rendering
Frontend Performance: Illusions & browser renderingFrontend Performance: Illusions & browser rendering
Frontend Performance: Illusions & browser rendering
 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJS
 
Measuring Web Performance - HighEdWeb Edition
Measuring Web Performance - HighEdWeb EditionMeasuring Web Performance - HighEdWeb Edition
Measuring Web Performance - HighEdWeb Edition
 
CSS3: the new style council
CSS3: the new style councilCSS3: the new style council
CSS3: the new style council
 
Tip from ConnectED 2015: How to Use Those Cool New Frameworks in Mobile Domin...
Tip from ConnectED 2015: How to Use Those Cool New Frameworks in Mobile Domin...Tip from ConnectED 2015: How to Use Those Cool New Frameworks in Mobile Domin...
Tip from ConnectED 2015: How to Use Those Cool New Frameworks in Mobile Domin...
 
Html5 browser api_support
Html5 browser api_supportHtml5 browser api_support
Html5 browser api_support
 

Más de Chris Mills

Empowering the "mobile web"
Empowering the "mobile web"Empowering the "mobile web"
Empowering the "mobile web"
Chris Mills
 
Documentation and publishing
Documentation and publishingDocumentation and publishing
Documentation and publishing
Chris Mills
 

Más de Chris Mills (20)

More efficient, usable web
More efficient, usable webMore efficient, usable web
More efficient, usable web
 
Feedback handling, community wrangling, panhandlin’
Feedback handling, community wrangling, panhandlin’Feedback handling, community wrangling, panhandlin’
Feedback handling, community wrangling, panhandlin’
 
APIs for modern web apps
APIs for modern web appsAPIs for modern web apps
APIs for modern web apps
 
APIs, now and in the future
APIs, now and in the futureAPIs, now and in the future
APIs, now and in the future
 
Guerrilla education
Guerrilla educationGuerrilla education
Guerrilla education
 
Web versus Native: round 1!
Web versus Native: round 1!Web versus Native: round 1!
Web versus Native: round 1!
 
BrazilJS MDN
BrazilJS MDNBrazilJS MDN
BrazilJS MDN
 
Empowering the "mobile web"
Empowering the "mobile web"Empowering the "mobile web"
Empowering the "mobile web"
 
Documentation and publishing
Documentation and publishingDocumentation and publishing
Documentation and publishing
 
MDN is easy!
MDN is easy!MDN is easy!
MDN is easy!
 
Getting rid of images with CSS
Getting rid of images with CSSGetting rid of images with CSS
Getting rid of images with CSS
 
Future layouts
Future layoutsFuture layouts
Future layouts
 
Laying out the future
Laying out the futureLaying out the future
Laying out the future
 
Accessibility doesn't exist
Accessibility doesn't existAccessibility doesn't exist
Accessibility doesn't exist
 
Responsive web design standards?
Responsive web design standards?Responsive web design standards?
Responsive web design standards?
 
Adapt! Media queries and viewport
Adapt! Media queries and viewportAdapt! Media queries and viewport
Adapt! Media queries and viewport
 
Adapt and respond: keeping responsive into the future
Adapt and respond: keeping responsive into the futureAdapt and respond: keeping responsive into the future
Adapt and respond: keeping responsive into the future
 
HTML5 Pearson preso
HTML5 Pearson presoHTML5 Pearson preso
HTML5 Pearson preso
 
Brave new world of HTML5
Brave new world of HTML5Brave new world of HTML5
Brave new world of HTML5
 
Inclusive design: real accessibility for everyone
Inclusive design: real accessibility for everyoneInclusive design: real accessibility for everyone
Inclusive design: real accessibility for everyone
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

HTML5 and CSS3: does now really mean now?

  • 1. CSS3 and HTML5 Does now really mean now? Saturday, 10 March 2012
  • 2. Hi! I’m Chris Mills ‣ Open standards advocate and education agitator ‣ dev.opera.com editor ‣ W3C web education community group chair ‣ Accessibility whiner ‣ HTML5/CSS3 wrangler ‣ Heavy metal drummer & proud dad Saturday, 10 March 2012
  • 4. cmills@opera.com @chrisdavidmills http://www.slideshare.net/chrisdavidmills http://dev.opera.com http://www.w3.org/community/webed/ Saturday, 10 March 2012
  • 5. What we’ll talk about ‣ Do you really need The Shiny™? ‣ Progressively enhance, don’t rely on it ‣ When progressive enhancement isn’t viable, provide alternatives, use feature detection... ‣ ...use polyfills/shims ‣ #sxsw #dnrmn (lol, lmao, wtf, etc.) Saturday, 10 March 2012
  • 7. Do you need it at all? Saturday, 10 March 2012
  • 12. HTML5 and CSS3 are fun ‣ But just because you can use them doesn’t mean you have to use them. All the bloody time! ‣ In the real world, with real clients, you are likely to have less freedom Saturday, 10 March 2012
  • 13. Do you need it? Saturday, 10 March 2012
  • 14. If you are going to use prefixed CSS/JS... background: -webkit-linear-gradient(#ff0000, #000000); background: -moz-linear-gradient(#ff0000, #000000); background: -ms-linear-gradient(#ff0000, #000000); background: -o-linear-gradient(#ff0000, #000000); background: linear-gradient(#ff0000, #000000); Saturday, 10 March 2012
  • 15. Progressive enhancement Saturday, 10 March 2012
  • 16. Don’t rely on The Shiny™ ‣ If *at all possible* ‣ Build a base level of functionality that works ‣ Then enhance the user experience Saturday, 10 March 2012
  • 17. Example: Ajax ‣ Ajax makes data updates more responsive ‣ But the base functionality could still work with no Ajax ‣ Albeit with page reloads Saturday, 10 March 2012
  • 18. Example: Offline apps ‣ Using apps offline is awesome ‣ But you’re probably not losing anything if your browser doesn’t support this ‣ http://dev.opera.com/articles/view/taking-your- web-apps-offline-web-storage-appcache- websql/ Saturday, 10 March 2012
  • 19. Example: CSS3 bling ‣ Content looks a lot nicer in supporting browsers ‣ Also more flexible than using old graphical methods ‣ But the content should still be accessible in older browsers ‣ http://www.alistapart.com/articles/css3-bling-in- the-real-world/ Saturday, 10 March 2012
  • 20. Example: CSS animation ‣ If done properly, a lot of CSS animations and transitions can be used unobtrusively ‣ For example, by default the element is set to be in its usable state, but then the animation is applied over the top to bring the animation to that state Saturday, 10 March 2012
  • 21. Example: Media queries ‣ One of the obvious ones! ‣ If media queries are not supported, the browser ignores them, and you get the standard layout ‣ Of course, this can be a problem if you are using the “mobile first” approach Saturday, 10 March 2012
  • 22. Example: Web fonts ‣ This is a perfect feature to use now! ‣ IE has supported EOT since IE4/5! ‣ You can use the bulletproof web font syntax - see fontsquirrel.com Saturday, 10 March 2012
  • 23. This is all fine... ‣ So long as your boss/client is cool with that! ‣ Many still obsess over identical layouts/ functionality across browsers Saturday, 10 March 2012
  • 24. Identical layout/functionality obsession ‣ A thing of the past? ‣ It is becoming much less of an issue, with so many different browsing platforms and devices now available ‣ Many different contexts require different layouts/ functionality for a good user experience Saturday, 10 March 2012
  • 25. Acceptable alternatives Saturday, 10 March 2012
  • 26. Ok, sometimes progressive enhancement isn’t really possible ‣ <img>! ‣ <canvas>/WebGL ‣ <video> ‣ Web sockets ‣ etc. Saturday, 10 March 2012
  • 27. Fallbacks often a good option ‣ Equivalence of service ‣ Useful for multiple user groups ‣ As long as they can access the content and services in some way, you should be ok Saturday, 10 March 2012
  • 28. HTML5 <video> ‣ Typical example of HTML5’s attitude to fallback Saturday, 10 March 2012
  • 29. HTML5 <video> <video controls> <source src="video-file.mp4" type="video/mp4"> <source src="video-file.webm" type="video/webm"> <track src="en.vtt" kind="subtitles" srclang="en" label="English subtitles"> <!-- Flash player often referenced in here: will play the MP4 version of the video --> </video> Saturday, 10 March 2012
  • 30. Flash fallbacks viable ‣ Might seem annoying to have to implement, but once you’ve got a template, you’re off. ‣ And Flash can just load the MP4 version of the video ‣ Also consider jPlayer, Sublime, etc. Saturday, 10 March 2012
  • 31. Unfortunately... ‣ The fallback content is for browsers that don’t support <video> ‣ Not for browsers that don’t support the format being offered up ‣ You’ll need multiple formats for the time being Saturday, 10 March 2012
  • 32. What about when alternative mechanisms don’t exist? ‣ Make your own! ‣ Use feature detection ‣ Basic tests, or a library like Modernizr Saturday, 10 March 2012
  • 33. Feature detection basics if (window.chrome) { // do stuff that works on Chrome } else { // ignore it, and do something else } Saturday, 10 March 2012
  • 34. Feature detection basics if (checkVideo()===true) { // do stuff that uses this method } else { // ignore it, and do something else } Saturday, 10 March 2012
  • 35. Modernizr ‣ The mother of all feature detection libraries ‣ Available at modernizr.com Saturday, 10 March 2012
  • 36. Modernizr CSS example <html lang="en-US" class="no-js"> <head> ... <script src="modernizr.js"></script> ... </head> Saturday, 10 March 2012
  • 37. Modernizr CSS example <html class=" js flexbox canvas canvastext webgl no- touch geolocation postmessage no-websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients no- cssreflections csstransforms no-csstransforms3d csstransitions fontface generatedcontent video audio localstorage no-sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths" lang="en-US"> Saturday, 10 March 2012
  • 38. Modernizr CSS example #wrapper:hover, #wrapper:focus { transform: rotateX(180deg); } Saturday, 10 March 2012
  • 39. Modernizr CSS example .no-csstransforms3d #wrapper #front { transition: 0.8s all ease-in; } .no-csstransforms3d #wrapper:hover #front, .no-csstransforms3d #wrapper:focus #front { transform: rotate(-30deg) translate(-50%,-100%); } Saturday, 10 March 2012
  • 40. Modernizr JS example function rotateForm() { if(Modernizr.cssanimations) { form.setAttribute("class","form-rotate"); form.style.left = "0rem"; } else { back.style.zIndex = "5"; }; }; Saturday, 10 March 2012
  • 41. In general, Modernizr rocks ‣ It can add a fair bit of weight to your page: 49KB for the full library ‣ But you can create a smaller custom version that just includes the tests you need ‣ There are some things that can’t be detected Saturday, 10 March 2012
  • 42. IE conditional comments <!--[if lte IE 8]> <link rel="stylesheet" href="iefixes.css" type="text/css"> <![endif]--> <!--[if lte IE 6]> <link rel="stylesheet" href="ie6.css" type="text/ css"> <![endif]--> Saturday, 10 March 2012
  • 44. Add in support where needed ‣ Using JavaScript ‣ Fake SVG in old IE versions using VML ‣ Fake box-shadow using IE filters (although they are evil — every time you use IE filters, god kills a kitten) Saturday, 10 March 2012
  • 45. Adding HTML5 support to browsers ‣ Older browsers don’t support them! ‣ But you can style any unknown element, so just set all the “block level” elements to display as block, at the top of your CSS: ‣ article { display: block; } Saturday, 10 March 2012
  • 46. Oh, but IE 6-8 need some more help ‣ They refuse to style unknown elements, unless you create instances of them in the DOM ‣ document.createElement('article'); Saturday, 10 March 2012
  • 47. CSS3 PIE for CSS bling support ‣ http://css3pie.com/ ‣ Awesome little library ‣ Add support to IE6-8 for box-shadow, border- radius, gradients and transparent colours ‣ But not text-shadow, which is a little frustrating Saturday, 10 March 2012
  • 48. CSS3-mediaqueries.js ‣ http://code.google.com/p/css3-mediaqueries-js/ ‣ Add media queries support to IE ‣ A bit clunky, when you resize, but it works Saturday, 10 March 2012
  • 49. Excanvas ‣ http://excanvas.sourceforge.net/ ‣ Add <canvas> support to IE Saturday, 10 March 2012
  • 50. Selectivizr ‣ http://selectivizr.com/ ‣ Adds support for CSS3 selectors to IE6-8 Saturday, 10 March 2012
  • 51. All sounds good, huh? ‣ Beware: slows down loading! ‣ Especially stuff that makes use of IE filters ‣ Can be mitigated by helpers such as YepNope Saturday, 10 March 2012
  • 53. Does now really mean now? Saturday, 10 March 2012
  • 54. Progressive enhancement and alternatives ‣ Can be successful ‣ But not everything is easy to provide for ‣ And your clients might not approve Saturday, 10 March 2012
  • 55. Polyfills ‣ Are great ‣ But complicate things ‣ And give a performance hit Saturday, 10 March 2012
  • 56. Think carefully ‣ Do you need to do it this way? ‣ Is there viable alternative content that can be provided, or different ways to implement it? Saturday, 10 March 2012
  • 57. It will be a while before things get easier Saturday, 10 March 2012
  • 58. More resources ‣ html5please.com ‣ caniuse.com ‣ Practical CSS3: design and develop (Peachpit Press, August 2012ish) Saturday, 10 March 2012
  • 59. Thanks! cmills@opera.com @chrisdavidmills http://www.slideshare.net/chrisdavidmills http://dev.opera.com http://www.w3.org/community/webed/ Saturday, 10 March 2012
  • 60. Thank you CC! Spidermen — http://www.flickr.com/photos/ralphman/792848885/ Schoolkids — http://www.flickr.com/photos/mallalamuseum/3838470381/ Old married couple — http://www.flickr.com/photos/adwriter/257937032/ No IE6 — http://www.navegabem.com Parrot — http://www.flickr.com/photos/young-in-panama/57895100/ Immortal — 10 most ridiculous black metal photos ever Saturday, 10 March 2012