SlideShare a Scribd company logo
HTML5 and CSS3 Techniques You Can Use TodayDEV334Todd AnglinChief EvangelistTelerik
IntroductionsTodd AnglinChief Evangelist, TelerikMicrosoft MVPASP InsiderPresident NHDNUG & O’Reilly AuthorTelerikWatch.com@toddanglin
Development ToolsAgile PlanningTesting
Session Road MapGoal: Leave with at least 1 HTML5/CSS3 technique you can use today
“While it continues to serve as a rough guide to many of the core features of HTML, it does not provide enough information to build implementations that interoperate with each other and, more importantly, with a critical mass of deployed content.”-W3C on HTML4
HTML4 = Rough GuideUnpredictable Browser Support
HTML & CSS HistoryHTML5Addressing modern web applications & pains of the past
HTML & CSS HistoryCSS: Plagued by implementation bugs & inconsistenciesCSS3Improve consistency & power of styling language
How is the web evolving?
{}<HTML>CSS:3;EMCAScript();“HTML5”
“Living Standard”	Offline		Canvas		  	Video      AudioWebSocketsFileAPIWebGL HTML5 FormsGeolocationWHATWG | W3C | IETF
StableCanvas | Local Storage |Microdata| Document Editing |Geolocation| Semantic Tags | Video/Audio | SelectorsIn ProgressWebGL | WebSockets | File API | Drag-Drop API | IndexDB |  Offline API | Web Workers | HTML5 Forms
HTML5 and CSS3 Techniques You Can Use Today
IE9 offers support for the most relevant, real-world web patterns that developers are using today as well as the HTML5 patterns we expect to become more mainstream.”“-Dean HachamovitchCorporate VP, IE
html5labs.interoperabilitybridges.com+Platform Previewsie.microsoft.com/testdrive
CSS 2.1SelectorsCSS ColorCSS 2Backgrounds &BordersMedia QueriesMulti-column25+ DraftsTransitionsTransformationsAnimationsGradientsCSS3 Text
-moz-border-radius: 5px 5px5px5px; -webkit-border-radius: 5px;border-radius: 5px;-moz-box-shadow: 2px 2px2px #333;-webkit-box-shadow: 2px 2px2px #333;box-shadow: 2px 2px2px #333;-webkit-background-size: 137px 50px;-o-background-size: 137px 50px;background-size: 137px 50px;
Browser Prefixes-webkit-moz-o-ms“standard” way browsers implement experimental features
Browser Prefixes15
WDLCCRPRRE
What is usable today?
Adoption StrategiesLowest Common DominatorOnly use features natively available in all target browsers
Adoption StrategiesPolyfillEnrichedOnly use features either natively available OR available via JavaScript polyfillX	      X
polyfill(n) poly • fill:  JavaScript that implants HTML5 functionality in a browser that does not offer native support
Adoption StrategiesAlternate ExperiencesOnly use features available in target browsers AND design alternate experience for other browsersX	      XX	      	             X	     XX					            X
progressiveenhancementgracefuldegradation
[Source: Aaron Olaf, Flickr]
[Source: Mercedes USA, http://mbusa.com/]
Adoption StrategiesVertical TargetCreate experiences targeted at specific browsers (or classes of browsers)X	      XX	      	             X	     XX					            X
Real World Browser SupportBetter, but not perfectKnow your users. Know your browsers.
HTML5 TechniquesYou can use today
W3C on HTML5Defines a single language called HTML5 which can be written in HTML syntax and in XML syntax.Defines detailed processing models to foster interoperable implementations.Improves markup for documents.Introduces markup and APIs for emerging idioms, such as Web applications.
Enriching VS ExperienceAdd IntelliSense & Schema Validation to Visual Studio 2008/2010 (pre SP1) editorhttp://bit.ly/vsHTML5http://bit.ly/vsSVG
Older Browsers
ModernizrShiv’r + InspectorSimple way to check feature supportConditional JS and CSS.multiplebgs div p {  /* properties for browsers that     support multiple backgrounds */}.no-multiplebgs div p {  /* optional fallback properties     for browsers that don't */}if (Modernizr.canvas) {   //Canvas supported}if (Modernizer.cssColumns){  //Columns supported}//Etc...*Don’t use with IE HTML5shiv. One or the other.
DEMOPolyfilling & Older Browserswith Modernizr
Semantic TagsTags with meaning<body>   <div id=“header”>   </div>   <div id=“content”>       <div id=“nav”></div>   </div>   <div id=“footer”>   </div></body><body>    <header>   </header>    <section>        <nav></nav>    </section>    <footer></footer></body>VS.*Need polyfill to trigger styling in old IESafe to use today!
Video & AudioSemantic rich mediaReach more people on more devicesContainerMP4H.264CodecSafe to use today!
GeolocationUsable on modern browsers + mobileRequires plug-in for older browsersnavigator.geolocation.getCurrentPosition(callback);function callback(position){varlat = position.coords.latitude;varlng = position.coords.longitude;varacc = position.coords.accuracy;}Safe to use today!
Local StorageUsable in modern browserssessionStorage.setItem('value', this.value);localStorage.setItem('value', this.value);sessionStorage.getItem(‘value’);sessionStorage.clear();localStorage.clear();sessionStorage = per windowlocalStorage = per browser5 MB limit
HTML5 FormsImproved usabilityUneven support across browsers<form name="f">  <input id="q" autofocus> <!--Technique to support older browsers-->  <script>    if (!("autofocus" in document.createElement("input"))) {document.getElementById("q").focus();    }  </script>  <input type="submit" value="Go"></form>Safe to use today!
Rich Snippets (*microdata)Content with meaningMachines understand more of your content<div itemscopeitemtype="http://data-vocabulary.org/Event">  <time itemprop="startDate" datetime="2015-10-15T19:00-08:00">      Oct 15, 7:00PM   </time>— <time itemprop="endDate"datetime="2015-10-15T19:00-08:00">      Oct 15, 9:00PM   </time>   <span itemprop="geo" itemscopeitemtype="http://data-vocabulary.org/​Geo"><meta itemprop="latitude" content="37.774929" /><meta itemprop="longitude" content="-122.419416" />         </span>...</div>Safe to use today!
SVG & CanvasSafe to use today!
Canvas for IE6/7/8Many polyfills for older browsersJavaScript or Flash basedBetter Perf
Custom Attributesdata-*Valid approach to storing data in HTML<!--Store values in data-* attributes--><div id="mydiv" data-key="26" data-name="My product name">This product is an extremely popular choice.</div><!--Access values with JavaScript-->varmydiv=document.getElementById('mydiv')//Using DOM's getAttribute() propertyvarkey = mydiv.getAttribute("data-key") //returns "26" //OR Using JavaScript's dataset property**var key = mydiv.dataset.key //returns "26"Safe to use today!
CSS3 TechniquesYou can use today
Leveling the Playing FieldCSS ResetBrowsers ship with built-in styles – zero them out!Enable newer features in older browsershttp://html5reset.orghttp://html5boilerplate.com
CSS3 SelectorsPowerful new selector options//Alternating Itemsli:nth-child(odd) { color: blue; }li:nth-child(even) { color: green; }li:nth-child(3n) { color: red; } //Every 3rd item//First/Last Itemsli:first-of-type { color: blue; }li:not(:first-of-type):not(:last-of-type) { color: orange; } //All *but* first/last//Enabled/Disabledinput:enabled {  border: 2px solid green; }input:disabled{  background-color: #BBB; }*Use jQuery to support legacy browsers
CSS3 ColorHSL and RGBSupport for new color models + alpha channels//HSLbackground:hsl(320,100%,25%);//HSLabackground:hsla(165, 100%, 50%, 1.0);//RGBbackground:rgb(155,100,100);//RGBabackground:rgba(153, 134, 117, 0.2);

More Related Content

PPTX
The Rich Standard: Getting Familiar with HTML5
PPTX
Edge of the Web
PPTX
Doing More with LESS for CSS
KEY
HTML5 Video Player - HTML5 Dev Conf 2012
PDF
Using HTML5 sensibly
PDF
Multimedia on the web - HTML5 video and audio
PDF
Taiwan Web Standards Talk 2011
PPTX
HTML5: An Overview
The Rich Standard: Getting Familiar with HTML5
Edge of the Web
Doing More with LESS for CSS
HTML5 Video Player - HTML5 Dev Conf 2012
Using HTML5 sensibly
Multimedia on the web - HTML5 video and audio
Taiwan Web Standards Talk 2011
HTML5: An Overview

What's hot (20)

KEY
It's a Mod World - A Practical Guide to Rocking Modernizr
PDF
[In Control 2010] HTML5
PDF
Brave new world of HTML5 - Interlink Conference Vancouver 04.06.2011
PPT
Html5 Overview
PPTX
Getting Started with HTML5 in Tech Com (STC 2012)
PDF
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
PDF
Web Development for UX Designers
PDF
HTML5 Introduction
PPTX
What is HTML 5?
PPTX
Html5 Overview
PDF
Introduction to web development
PDF
Mastering WordPress Vol.1
PPTX
High Performance JavaScript (CapitolJS 2011)
PDF
Wrangling Large Scale Frontend Web Applications
PPTX
Training HTML5 CSS3 Ilkom IPB
PDF
Progressive Enhancement
PPTX
Razor into the Razor'verse
PDF
Technical SEO for WordPress - 2019 edition
PPTX
How fast are we going now?
PDF
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
It's a Mod World - A Practical Guide to Rocking Modernizr
[In Control 2010] HTML5
Brave new world of HTML5 - Interlink Conference Vancouver 04.06.2011
Html5 Overview
Getting Started with HTML5 in Tech Com (STC 2012)
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
Web Development for UX Designers
HTML5 Introduction
What is HTML 5?
Html5 Overview
Introduction to web development
Mastering WordPress Vol.1
High Performance JavaScript (CapitolJS 2011)
Wrangling Large Scale Frontend Web Applications
Training HTML5 CSS3 Ilkom IPB
Progressive Enhancement
Razor into the Razor'verse
Technical SEO for WordPress - 2019 edition
How fast are we going now?
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
Ad

Similar to HTML5 and CSS3 Techniques You Can Use Today (20)

PPTX
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
PPT
Is it time to start using HTML 5
PPT
Rey Bango - HTML5: polyfills and shims
PPTX
HTML5 and CSS3 Techniques You Can Use Today
PPTX
HTML 5 - A developers perspective
PPTX
HTML5 Bootcamp: Essential HTML, CSS, & JavaScript
PPT
HTML5 Overview
PPTX
Making HTML5 Work Everywhere
PPTX
Html5 & less css
PPTX
HTML5 introduction for beginners
PPT
Html5(2)
PPT
Html5(2)
PPT
Thadomal IEEE-HTML5-Workshop
PPTX
Bringing HTML5 alive in SharePoint
PDF
Echo HTML5
PPTX
Top 10 HTML5 features every developer should know!
PDF
HTML5 development in 30 minutes
PDF
Word camp nextweb
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Is it time to start using HTML 5
Rey Bango - HTML5: polyfills and shims
HTML5 and CSS3 Techniques You Can Use Today
HTML 5 - A developers perspective
HTML5 Bootcamp: Essential HTML, CSS, & JavaScript
HTML5 Overview
Making HTML5 Work Everywhere
Html5 & less css
HTML5 introduction for beginners
Html5(2)
Html5(2)
Thadomal IEEE-HTML5-Workshop
Bringing HTML5 alive in SharePoint
Echo HTML5
Top 10 HTML5 features every developer should know!
HTML5 development in 30 minutes
Word camp nextweb
Ad

More from Todd Anglin (10)

PDF
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
PPTX
Developing a Modern Mobile App Strategy
PPT
HTML5 Mullet: Forms & Input Validation
PPTX
5 Tips for Better JavaScript
PPTX
50in50: Resources for HTML5, CSS3, & JavaScript Developers
PDF
Using HTML5 to Build Mobile Apps
PPTX
HTML5 for Tablets and Mobile
PPT
Building RESTful Applications with OData
PPT
Building a Testable Data Access Layer
PPTX
What’s New in ASP.NET 4
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
Developing a Modern Mobile App Strategy
HTML5 Mullet: Forms & Input Validation
5 Tips for Better JavaScript
50in50: Resources for HTML5, CSS3, & JavaScript Developers
Using HTML5 to Build Mobile Apps
HTML5 for Tablets and Mobile
Building RESTful Applications with OData
Building a Testable Data Access Layer
What’s New in ASP.NET 4

Recently uploaded (20)

PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
cuic standard and advanced reporting.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PPT
Teaching material agriculture food technology
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Network Security Unit 5.pdf for BCA BBA.
Digital-Transformation-Roadmap-for-Companies.pptx
Machine learning based COVID-19 study performance prediction
The Rise and Fall of 3GPP – Time for a Sabbatical?
Unlocking AI with Model Context Protocol (MCP)
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Per capita expenditure prediction using model stacking based on satellite ima...
MYSQL Presentation for SQL database connectivity
Review of recent advances in non-invasive hemoglobin estimation
“AI and Expert System Decision Support & Business Intelligence Systems”
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
cuic standard and advanced reporting.pdf
Electronic commerce courselecture one. Pdf
A comparative analysis of optical character recognition models for extracting...
Teaching material agriculture food technology
Spectral efficient network and resource selection model in 5G networks
gpt5_lecture_notes_comprehensive_20250812015547.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx

HTML5 and CSS3 Techniques You Can Use Today

  • 1. HTML5 and CSS3 Techniques You Can Use TodayDEV334Todd AnglinChief EvangelistTelerik
  • 2. IntroductionsTodd AnglinChief Evangelist, TelerikMicrosoft MVPASP InsiderPresident NHDNUG & O’Reilly AuthorTelerikWatch.com@toddanglin
  • 4. Session Road MapGoal: Leave with at least 1 HTML5/CSS3 technique you can use today
  • 5. “While it continues to serve as a rough guide to many of the core features of HTML, it does not provide enough information to build implementations that interoperate with each other and, more importantly, with a critical mass of deployed content.”-W3C on HTML4
  • 6. HTML4 = Rough GuideUnpredictable Browser Support
  • 7. HTML & CSS HistoryHTML5Addressing modern web applications & pains of the past
  • 8. HTML & CSS HistoryCSS: Plagued by implementation bugs & inconsistenciesCSS3Improve consistency & power of styling language
  • 9. How is the web evolving?
  • 11. “Living Standard” Offline Canvas Video AudioWebSocketsFileAPIWebGL HTML5 FormsGeolocationWHATWG | W3C | IETF
  • 12. StableCanvas | Local Storage |Microdata| Document Editing |Geolocation| Semantic Tags | Video/Audio | SelectorsIn ProgressWebGL | WebSockets | File API | Drag-Drop API | IndexDB | Offline API | Web Workers | HTML5 Forms
  • 14. IE9 offers support for the most relevant, real-world web patterns that developers are using today as well as the HTML5 patterns we expect to become more mainstream.”“-Dean HachamovitchCorporate VP, IE
  • 16. CSS 2.1SelectorsCSS ColorCSS 2Backgrounds &BordersMedia QueriesMulti-column25+ DraftsTransitionsTransformationsAnimationsGradientsCSS3 Text
  • 17. -moz-border-radius: 5px 5px5px5px; -webkit-border-radius: 5px;border-radius: 5px;-moz-box-shadow: 2px 2px2px #333;-webkit-box-shadow: 2px 2px2px #333;box-shadow: 2px 2px2px #333;-webkit-background-size: 137px 50px;-o-background-size: 137px 50px;background-size: 137px 50px;
  • 18. Browser Prefixes-webkit-moz-o-ms“standard” way browsers implement experimental features
  • 21. What is usable today?
  • 22. Adoption StrategiesLowest Common DominatorOnly use features natively available in all target browsers
  • 23. Adoption StrategiesPolyfillEnrichedOnly use features either natively available OR available via JavaScript polyfillX X
  • 24. polyfill(n) poly • fill: JavaScript that implants HTML5 functionality in a browser that does not offer native support
  • 25. Adoption StrategiesAlternate ExperiencesOnly use features available in target browsers AND design alternate experience for other browsersX XX X XX X
  • 28. [Source: Mercedes USA, http://mbusa.com/]
  • 29. Adoption StrategiesVertical TargetCreate experiences targeted at specific browsers (or classes of browsers)X XX X XX X
  • 30. Real World Browser SupportBetter, but not perfectKnow your users. Know your browsers.
  • 32. W3C on HTML5Defines a single language called HTML5 which can be written in HTML syntax and in XML syntax.Defines detailed processing models to foster interoperable implementations.Improves markup for documents.Introduces markup and APIs for emerging idioms, such as Web applications.
  • 33. Enriching VS ExperienceAdd IntelliSense & Schema Validation to Visual Studio 2008/2010 (pre SP1) editorhttp://bit.ly/vsHTML5http://bit.ly/vsSVG
  • 35. ModernizrShiv’r + InspectorSimple way to check feature supportConditional JS and CSS.multiplebgs div p { /* properties for browsers that support multiple backgrounds */}.no-multiplebgs div p { /* optional fallback properties for browsers that don't */}if (Modernizr.canvas) { //Canvas supported}if (Modernizer.cssColumns){ //Columns supported}//Etc...*Don’t use with IE HTML5shiv. One or the other.
  • 36. DEMOPolyfilling & Older Browserswith Modernizr
  • 37. Semantic TagsTags with meaning<body> <div id=“header”> </div> <div id=“content”> <div id=“nav”></div> </div> <div id=“footer”> </div></body><body> <header> </header> <section> <nav></nav> </section> <footer></footer></body>VS.*Need polyfill to trigger styling in old IESafe to use today!
  • 38. Video & AudioSemantic rich mediaReach more people on more devicesContainerMP4H.264CodecSafe to use today!
  • 39. GeolocationUsable on modern browsers + mobileRequires plug-in for older browsersnavigator.geolocation.getCurrentPosition(callback);function callback(position){varlat = position.coords.latitude;varlng = position.coords.longitude;varacc = position.coords.accuracy;}Safe to use today!
  • 40. Local StorageUsable in modern browserssessionStorage.setItem('value', this.value);localStorage.setItem('value', this.value);sessionStorage.getItem(‘value’);sessionStorage.clear();localStorage.clear();sessionStorage = per windowlocalStorage = per browser5 MB limit
  • 41. HTML5 FormsImproved usabilityUneven support across browsers<form name="f"> <input id="q" autofocus> <!--Technique to support older browsers--> <script> if (!("autofocus" in document.createElement("input"))) {document.getElementById("q").focus(); } </script> <input type="submit" value="Go"></form>Safe to use today!
  • 42. Rich Snippets (*microdata)Content with meaningMachines understand more of your content<div itemscopeitemtype="http://data-vocabulary.org/Event"> <time itemprop="startDate" datetime="2015-10-15T19:00-08:00"> Oct 15, 7:00PM </time>— <time itemprop="endDate"datetime="2015-10-15T19:00-08:00"> Oct 15, 9:00PM </time> <span itemprop="geo" itemscopeitemtype="http://data-vocabulary.org/​Geo"><meta itemprop="latitude" content="37.774929" /><meta itemprop="longitude" content="-122.419416" /> </span>...</div>Safe to use today!
  • 43. SVG & CanvasSafe to use today!
  • 44. Canvas for IE6/7/8Many polyfills for older browsersJavaScript or Flash basedBetter Perf
  • 45. Custom Attributesdata-*Valid approach to storing data in HTML<!--Store values in data-* attributes--><div id="mydiv" data-key="26" data-name="My product name">This product is an extremely popular choice.</div><!--Access values with JavaScript-->varmydiv=document.getElementById('mydiv')//Using DOM's getAttribute() propertyvarkey = mydiv.getAttribute("data-key") //returns "26" //OR Using JavaScript's dataset property**var key = mydiv.dataset.key //returns "26"Safe to use today!
  • 47. Leveling the Playing FieldCSS ResetBrowsers ship with built-in styles – zero them out!Enable newer features in older browsershttp://html5reset.orghttp://html5boilerplate.com
  • 48. CSS3 SelectorsPowerful new selector options//Alternating Itemsli:nth-child(odd) { color: blue; }li:nth-child(even) { color: green; }li:nth-child(3n) { color: red; } //Every 3rd item//First/Last Itemsli:first-of-type { color: blue; }li:not(:first-of-type):not(:last-of-type) { color: orange; } //All *but* first/last//Enabled/Disabledinput:enabled { border: 2px solid green; }input:disabled{ background-color: #BBB; }*Use jQuery to support legacy browsers
  • 49. CSS3 ColorHSL and RGBSupport for new color models + alpha channels//HSLbackground:hsl(320,100%,25%);//HSLabackground:hsla(165, 100%, 50%, 1.0);//RGBbackground:rgb(155,100,100);//RGBabackground:rgba(153, 134, 117, 0.2);
  • 50. Custom FontsBiggest Problem?Licensing!@font-face { font-family: Delicious; src: url('Delicious-Roman.otf') format(“opentype”); } //Usageh3 { font-family: Delicious, sans-serif; }
  • 51. Web Font ProvidersSolve the licensing problemHost the WOFF/TTF/OTF font files Provide easy-to-use codehttp://www.fontsquirrel.com/http://webfonts.fonts.comhttp://typekit.com/librarieshttp://code.google.com/webfonts
  • 52. Borders & BackgroundsRounded corners, drop shadows, multi-backgroundsExpect GD for older browsers//Rounded Corners (Size)border-radius: 5px;//Drop shadow (hShift vShift Size Color)box-shadow: 2px 2px 5px #333; //Background controlbackground: url(top.gif) top left no-repeat,url(bottom.gif) bottom left no-repeat;background-size: 150px 50px;*Use CSS3 PIE to support legacy IE browsers
  • 53. Drop ShadowsExactly like it soundsbox-shadow: <hShift> <vShift> <size> <color>;-moz-box-shadow: 2px 2px2px #333;-webkit-box-shadow: 2px 2px2px #333;box-shadow: 2px 2px2px #333;Safe to use today!
  • 54. Text ShadowsUniform across supported browsers!text-shadow: <h offest> <v offset> <blur size> <color>;text-shadow: 2px 2px2px #333;//You can apply multiple shadowstext-shadow: 2px 2px2px #333, 2px 2px 3px #CCC;Safe to use today!
  • 55. BackgroundsMore options, more powermultiple backgroundsresize backgroundsbackground clipping/*Background size*/-webkit-background-size: 137px 50px;-o-background-size: 137px 50px;background-size: 137px 50px;/*Multiple Backgrounds*/background: url(top.gif) top left no-repeat,url(bottom.gif) bottom left no-repeat,url(middle.gif) left repeat-y;/*Background origin*/background-origin: border;/*Other options: padding or content*/Safe to use today!
  • 56. GradientsEmerging CSS standardBut useful and desirableCan be “shived” to support all browsers
  • 57. Media QueriesTarget styles to specific devices…And features!/*These two rules do the same thing*/@media all and (min-width:500px) { … } @media (min-width:500px) { … }/*Multiple conditions*/@media screen and (min-width: 600px) and (max-width: 900px) { .class { background: #333; }}
  • 58. LESS for CSSUse LESS to write less CSSVariables, operations, mix-ins, nested rules<link rel="stylesheet/less" href="style.less" type="text/css" /><script src="http://lesscss.googlecode.com/files/less-1.0.21.min.js"></script>/*Variables*/@primaryColor: #383939;background-color: @primaryColor;/*Mix-ins!!*/.roundedCorners (@radius: 12px) { -moz-border-radius: @radius; -webkit-border-radius: @radius; border-radius: @radius;}#page { background-color: @primaryColor; .roundedCorners; }Safe to use today!
  • 59. Animating with CSSAnimate by setting CSS propertiesWorks when JS is disabled#id_of_element { -webkit-transition: all 1s ease-in-out; -moz-transition: all 1s ease-in-out; -o-transition: all 1s ease-in-out; transition: all 1s ease-in-out; }Safe to use today!

Editor's Notes

  • #2: As more browsers deliver rich support for the next generation of standards-based web development, new techniques are enabling web developers to design with unprecedented levels of control. In this session, learn practical HTML5 and CSS3 techniques that you can use in any web project today. Learn how to easily add drop shadows to HTML objects, how to quickly create rounded corners, how to use custom fonts, and even how to animate with CSS. All techniques are demonstrated with special attention to cross-browser support and tips for supporting older browsers
  • #6: http://dev.w3.org/html5/html4-differences/Goes on to say:The same goes for XHTML1, which defines an XML serialization for HTML4, and DOM Level 2 HTML, which defines JavaScript APIs for both HTML and XHTML. HTML5 will replace these documents.
  • #8: http://en.wikipedia.org/wiki/HTML
  • #9: http://en.wikipedia.org/wiki/Cascading_Style_SheetsIE Mac: Shipped in March 2000First browser to 100% support CSS: IE on Mac!9 style sheet languages proposed in early 90sLanguages:1996:JavaScript Style Sheets (JSSS) – Netscape1994: Cascading HTML Style Sheets (CHSS)1994: Stream-based Style Sheet Proposal (SSP)
  • #12: WHATWG FAQs on Living Standard: http://wiki.whatwg.org/wiki/FAQ#What_does_.22Living_Standard.22_mean.3F
  • #14: What is the IE strategy for HTML5/CSS3?
  • #15: On Microsoft’s strategy/approach to HTML5:http://blogs.msdn.com/b/ie/archive/2010/12/20/html5-site-ready-and-experimental.aspxhttp://blogs.msdn.com/b/interoperability/archive/2010/12/21/prototyping-early-w3c-html5-specifications.aspx
  • #16: http://html5labs.interoperabilitybridges.com/http://www.beautyoftheweb.com
  • #17: CSS3’s evolutionary approachMicrosoft is focusing primarily on adding product support at the Candidate Recommendation stageReview status of various CSS3 proposed specs: http://www.w3.org/Style/CSS/current-work
  • #19: Microsoft Extensions: http://blogs.msdn.com/b/ie/archive/2008/09/08/microsoft-css-vendor-extensions.aspxVendor specific prefixes: http://reference.sitepoint.com/css/vendorspecific
  • #20: -Show example of browser prefixes in actionhttp://www.w3.org/TR/CSS21/syndata.html#vendor-keywords
  • #21: CSS3’s evolutionary approachMicrosoft is focusing primarily on adding product support at the Candidate Recommendation stageReview status of various CSS3 proposed specs: http://www.w3.org/Style/CSS/current-work
  • #22: This is not a question with a single correct answer. It all depends on your audience and strategy.There are several general strategies for defining what is “usable” today.
  • #25: Useful for adding HTML5 to both older browsers + new browsers that do not have a specific HTML5 featurehttp://remysharp.com/2010/10/08/what-is-a-polyfill/https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills
  • #28: Strategy: Design for lowest common denominator, Enrich/Enhance as more capabilities are availableImage Source: http://www.flickr.com/photos/aaronolaf/833342657/
  • #29: Strategy: Design for best case scenario (premium features), and gracefully remove features as resources are not availableImage Source: http://www.mbusa.com/mercedes/index
  • #33: http://dev.w3.org/html5/html4-differences/
  • #34: HTML5 &amp; CSS3 in VS2010 SP1: http://madskristensen.net/post/HTML5-CSS3-in-Visual-Studio-2010-SP1.aspxHTML5 in VS2008: http://stackoverflow.com/questions/1682180/will-visual-studio-2010-support-html-5
  • #35: http://code.google.com/p/ie7-js/Testing IE:http://spoon.net/browsers/Three choices: Hack it – Force features with JS shivsSupport it – Provide gracefully degraded experienceKill it – Provide message indicating no or limited support
  • #36: http://www.modernizr.comhttp://www.alistapart.com/articles/taking-advantage-of-html5-and-css3-with-modernizr/Modernizr now ships with ASP.NET MVC 3
  • #40: http://diveintohtml5.org/geolocation.htmlSpec: http://dev.w3.org/geo/api/spec-source.htmlOnly lat, long, acc are guranteed. Other values might be available, including altitude, altitudeAccuracy, heading, speedCan force maximum age for cached geolocation objectsCan handle errors and make repeat location calls using navigatior.geolocation.watchPosition(successCallback, errorCallback, {maximumAge:time})Google Maps API v3 Reference: http://code.google.com/apis/maps/documentation/javascript/basics.html(Free to use on all apps that are free to consumers – no API keys needed)
  • #41: http://html5demos.com/storageTutorial:http://html5tutorial.net/tutorials/working-with-html5-localstorage.htmlFallback for older browsers: http://amplifyjs.com/api/store/
  • #42: http://diveintohtml5.org/forms.htmlPolyfills for other HTML5 features:http://ericleads.com/h5validate/
  • #43: http://www.google.com/support/webmasters/bin/answer.py?hl=en&amp;answer=164506Google tool for testing Rich Snippets: http://www.google.com/webmasters/tools/richsnippetsGoogle will not show content from hidden div&apos;s in Rich Snippets.Currently, review sites and social networking/people profile sites are eligible. We plan to expand Rich Snippets to other types of content in the future. (Sept 2010)http://knol.google.com/k/google-rich-snippets-tips-and-tricksImprove video discovery: http://googlewebmastercentral.blogspot.com/2009/09/supporting-facebook-share-and-rdfa-for.htmlAnother very popular emerging microformat: Open Graph (by Facebook)http://developers.facebook.com/tools/linthttp://ogp.me/
  • #44: http://upload.wikimedia.org/wikipedia/en/d/d0/Chrome_Logo.svgComparison articles:Great comparison: http://dev.opera.com/articles/view/svg-or-canvas-choosing-between-the-two/http://blogs.sitepoint.com/2010/07/06/canvas-vs-svg-how-to-choose/ (IDEA: progressive enhancement techniques — for example, IE8 and earlier versions show a table of data whereas supported browsers show an animated pie chart.)SVG Bridge for all browsers:http://raphaeljs.com/CANVAS Bridge for IE: http://code.google.com/p/explorercanvas/(Pointless canvas example: http://paulirish.com/2010/high-res-browser-icons/)SVG is DOM-based. All elements exist in DOM. Thus, you can attach event handlers. CON: Many objects can hurt perf.CANVAS is PIXEL-based. All elements rendered quickly, but not part of DOM. CON: Harder to interact.
  • #45: http://flashcanvas.net/http://code.google.com/p/explorercanvas/
  • #46: http://www.javascriptkit.com/dhtmltutors/customattributes.shtmlhttp://html5doctor.com/html5-custom-data-attributes/Two methods of access:- Via Attributes (http://api.jquery.com/category/attributes/)Via “dataset” (plug-in required today: http://www.orangesoda.net/jquery.dataset.html)
  • #47: http://www.impressivewebs.com/css3-click-chart/
  • #48: http://html5reset.org/http://meyerweb.com/eric/tools/css/reset/http://html5doctor.com/html-5-reset-stylesheet/http://html5boilerplate.com/
  • #51: @font-face was first proposed for CSS2 and has been implemented in Internet Explorer since version 5IE relied on proprietary Embedded Open Type (.eot)Old school solutions involved things like sIFR (http://www.mikeindustries.com/blog/sifr/)Modern browsers finally support TTF and OTF + Most support new WOFF (exception is Safari)Resources:http://www.css3.info/preview/web-fonts-with-font-face/http://www.alistapart.com/articles/cssatten
  • #52: Making fonts compatible with IE requires some work-around:http://randsco.com/index.php/2009/07/04/p680\\Discussion of WOFF:http://en.wikipedia.org/wiki/Web_Open_Font_Format
  • #53: Fix “bleeding” in Webkit with: -webkit-background-clip: padding-box;http://tumble.sneak.co.nz/post/928998513/fixing-the-background-bleedhttp://css3pie.com/
  • #55: Not supported in IE9
  • #56: http://designshack.co.uk/articles/introduction-to-css3-part-6-backgroundshttp://www.css3.info/preview/background-origin-and-background-clip/
  • #57: Relatively new CSS standard defining Gradients: http://www.w3.org/TR/css3-images/IMAGES FROM: http://www.webdesignerwall.com/tutorials/cross-browser-css-gradient/Great visual CSS gradient generator: http://www.display-inline.fr/projects/css-gradient/#startType=hex&amp;startValue=aaeeff&amp;endType=hex&amp;endValue=3399ccSimple Visual gradient creator: http://gradients.glrzad.com/Good explanation:http://www.dynamicdrive.com/style/csslibrary/item/css3_linear_gradients/background: black;background: -moz-linear-gradient(top, black, white);background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(black), to(white)); /*You can also make gradient stops*/-moz-linear-gradient( top,rgb(214,24,166) 0%,rgb(255,51,200) 50%,rgb(255,77,240) 87%)
  • #58: http://www.webdesignerwall.com/tutorials/css3-media-queries/http://www.w3.org/TR/css3-mediaqueries/http://www.w3.org/TR/2010/CR-css3-mediaqueries-20100727/
  • #59: Great tutorial:http://designshack.co.uk/articles/css/using-less-js-to-simplify-your-css3LESS site: http://lesscss.org/
  • #60: Not currently supported in IE9CSS3 Animation Examples:http://webdeveloperjuice.com/demos/css/css3effects.html#secondhttp://anthonycalzadilla.com/css3-ATAT/index.htmlhttp://www.optimum7.com/css3-man/animation.html
  • #61: Great resourcefor checking mobile support: http://caniuse.com