4. Session Road Map Goal: 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
11. “Living Standard” Offline Canvas Video Audio WebSocketsFileAPI WebGL HTML5 Forms Geolocation WHATWG | W3C | IETF
12. Stable Canvas | Local Storage |Microdata| Document Editing |Geolocation| Semantic Tags | Video/Audio | Selectors In Progress WebGL | WebSockets | File API | Drag-Drop API | IndexDB | Offline API | Web Workers | HTML5 Forms
13.
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 Hachamovitch Corporate VP, IE
24. polyfill (n) poly • fill: JavaScript that implants HTML5 functionality in a browser that does not offer native support
25. Adoption Strategies Alternate Experiences Only use features available in target browsers AND design alternate experience for other browsers X X X X X X X
32. W3C on HTML5 Defines 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 Experience Add IntelliSense & Schema Validation to Visual Studio 2008/2010 (pre SP1) editor http://bit.ly/vsHTML5 http://bit.ly/vsSVG
35. Modernizr Shiv’r + Inspector Simple way to check feature support Conditional 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.
37. Semantic Tags Tags 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 IE Safe to use today!
38. Video & Audio Semantic rich media Reach more people on more devices Container MP4 H.264 Codec Safe to use today!
39. Geolocation Usable on modern browsers + mobile Requires plug-in for older browsers navigator.geolocation.getCurrentPosition(callback); function callback(position){ varlat = position.coords.latitude; varlng = position.coords.longitude; varacc = position.coords.accuracy; } Safe to use today!
40. Local Storage Usable in modern browsers sessionStorage.setItem('value', this.value); localStorage.setItem('value', this.value); sessionStorage.getItem(‘value’); sessionStorage.clear(); localStorage.clear(); sessionStorage = per window localStorage = per browser 5 MB limit
41. HTML5 Forms Improved usability Uneven 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 meaning Machines 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" itemscope itemtype="http://data-vocabulary.org/Geo"> <meta itemprop="latitude" content="37.774929" /> <meta itemprop="longitude" content="-122.419416" /> </span> ... </div> Safe to use today!
44. Canvas for IE6/7/8 Many polyfills for older browsers JavaScript or Flash based Better Perf
45. Custom Attributes data-* 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() property varkey = 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 Field CSS Reset Browsers ship with built-in styles – zero them out! Enable newer features in older browsers http://html5reset.org http://html5boilerplate.com
49. CSS3 Color HSL and RGB Support for new color models + alpha channels //HSL background:hsl(320,100%,25%); //HSLa background:hsla(165, 100%, 50%, 1.0); //RGB background:rgb(155,100,100); //RGBa background:rgba(153, 134, 117, 0.2);
51. Web Font Providers Solve the licensing problem Host the WOFF/TTF/OTF font files Provide easy-to-use code http://www.fontsquirrel.com/ http://webfonts.fonts.com http://typekit.com/libraries http://code.google.com/webfonts
52. Borders & Backgrounds Rounded corners, drop shadows, multi-backgrounds Expect GD for older browsers //Rounded Corners (Size) border-radius: 5px; //Drop shadow (hShift vShift Size Color) box-shadow: 2px 2px 5px #333; //Background control background: 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 Shadows Exactly like it sounds box-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 Shadows Uniform across supported browsers! text-shadow: <h offest> <v offset> <blur size> <color>; text-shadow: 2px 2px2px #333; //You can apply multiple shadows text-shadow: 2px 2px2px #333, 2px 2px 3px #CCC; Safe to use today!
55. Backgrounds More options, more power multiple backgrounds resize backgrounds background 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. Gradients Emerging CSS standard But useful and desirable Can be “shived” to support all browsers
57. Media Queries Target 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 CSS Use LESS to write less CSS Variables, 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 CSS Animate by setting CSS properties Works 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!
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
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.
http://en.wikipedia.org/wiki/HTML
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)
WHATWG FAQs on Living Standard: http://wiki.whatwg.org/wiki/FAQ#What_does_.22Living_Standard.22_mean.3F
What is the IE strategy for HTML5/CSS3?
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
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
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
-Show example of browser prefixes in actionhttp://www.w3.org/TR/CSS21/syndata.html#vendor-keywords
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
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.
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
Strategy: Design for lowest common denominator, Enrich/Enhance as more capabilities are availableImage Source: http://www.flickr.com/photos/aaronolaf/833342657/
Strategy: Design for best case scenario (premium features), and gracefully remove features as resources are not availableImage Source: http://www.mbusa.com/mercedes/index
http://dev.w3.org/html5/html4-differences/
HTML5 & 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
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
http://www.modernizr.comhttp://www.alistapart.com/articles/taking-advantage-of-html5-and-css3-with-modernizr/Modernizr now ships with ASP.NET MVC 3
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)
http://html5demos.com/storageTutorial:http://html5tutorial.net/tutorials/working-with-html5-localstorage.htmlFallback for older browsers: http://amplifyjs.com/api/store/
http://diveintohtml5.org/forms.htmlPolyfills for other HTML5 features:http://ericleads.com/h5validate/
http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=164506Google tool for testing Rich Snippets: http://www.google.com/webmasters/tools/richsnippetsGoogle will not show content from hidden div'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/
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.
@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
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
Fix “bleeding” in Webkit with: -webkit-background-clip: padding-box;http://tumble.sneak.co.nz/post/928998513/fixing-the-background-bleedhttp://css3pie.com/
Great tutorial:http://designshack.co.uk/articles/css/using-less-js-to-simplify-your-css3LESS site: http://lesscss.org/
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
Great resourcefor checking mobile support: http://caniuse.com