• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Is it time to start using HTML 5
 

Is it time to start using HTML 5

on

  • 5,722 views

 

Statistics

Views

Total Views
5,722
Views on SlideShare
5,432
Embed Views
290

Actions

Likes
2
Downloads
86
Comments
0

7 Embeds 290

http://learni.st 262
http://ravirajsblog.blogspot.com 15
http://www.linkedin.com 6
http://ravirajsblog.blogspot.in 4
http://ravirajsblog.blogspot.co.uk 1
http://ravirajsblog.blogspot.com.ar 1
http://staging.learni.st 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

CC Attribution-NonCommercial LicenseCC Attribution-NonCommercial License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Is it time to start using HTML 5 Is it time to start using HTML 5 Presentation Transcript

    • Rough Timeline of Web Technologies
      • 1991 HTML
      • 1994 HTML 2
      • 1996 CSS 1 + JavaScript
      • 1997 HTML 4
      • 1998 CSS 2
      • 2000 XHTML 1
      • 2002 Tableless Web Design
      • 2005 AJAX
      • 2009 HTML 5
    • HTML5 = Next Generation Features for Modern Web Development
      • HTML5 ~= HTML + CSS + JS APIs
    • HTML5 - HTML
      • Semantics (New tags, Link Relations, Microdata)
      • Accessibility (ARIA roles)
      • Web Forms 2.0 (Input Fields)
      • Multimedia (Audio Tag, Video Tag)
      • 2D and 3D drawing (Canvas, WebGL, SVG)
    • HTML5- JS
      • Client Side Storage (Web SQL Database, App Cache, Web Storage)
      • Communication (Web Sockets, Worker Workers)
      • Desktop experience (Notifications, Drag and Drop API)
      • Geolocation
    • HTML5 - CSS
      • Typography
      • Visuals
      • Transitions, transforms and animations
    • Why HTML 5 if we have HTML 4 !
      • HTML5 is basically the same as HTML4 but with some nice additional features.
      • We don't need to start implementing all HTML5. HTML5 is still in draft spec (and will be for a long time)
    • Is it time to start using HTML5?
      • Yes and no. There are HTML5 features that we can use today, but it would be wrong to say than we can use all of HTML5 today. When a given feature has two interoperable implementations among Firefox, Opera, IE8 and WebKit, it is OK to use that feature. If a feature hasn’t been implemented yet, we probably shouldn’t try to use it speculatively.
      • If our website needs to be accessible from people who are on IE6, then of course the set of available HTML5 functionality is quite limited (Heck IE6 barely supports CSS2.1) - but the most important bits (<video>, <canvas>) have workarounds available.
      • IE8 beta 2 supports two APIs from HTML5: cross-document messaging and non-SQL storage.
    • Need to Discuss on following points.
      • What kind of IE6 support does you want? In particular, can you make a site that will have some more features on &quot;non-IE6 browsers&quot;, at the cost of nearly no development time?
      • What features do you want to use?
      • Some features bring semantic sugar but are not really worth the hassle - even when &quot;supported&quot;. (<article>, <date>…)
      • Some features bring (mostly) eye-candy, but absence of support won't usually break your site. (CSS3 corners, HTML5 forms)
      • Some features can become the cornerstone of your site (<canvas>, <video>), especially if you want your site to be accessible from smartphones. (Even with Android getting Flash, I suspect many users won't activate it if not forced in order to spare battery life)
      • What features can you afford to use?
      • Some features degrade extremely gracefully - that is, you don't have any work to do when the browser offers no support, and people with non-supporting browsers won't even notice that they are missing on something (HTML5 forms)
      • Most useful features have relatively widespread workarounds for non-supporting browsers (mostly IE), generally implemented in Javascript or Flash. (HTML5 stylable markup, CSS3 corners, <video>, <canvas>) - but it will come at a price in site performance and design time.
    • Back to HTML 5 -:)
      • HTML5 is the next generation of HTML, superseding HTML 4.01, XHTML 1.0, and XHTML 1.1. HTML5 provides new features that are necessary for modern web applications.
      • HTML5 is designed to be cross-platform
      • The mobile web browsers that come pre-installed on iPhones, iPads, and Android phones all have excellent support for HTML5. At last , Microsoft has announced that the version 9 of Internet Explorer will support some HTML5 functionality.
    • Detecting HTML5 features
      • When your browser renders a web page, it constructs a Document Object Model (DOM), a collection of objects that represent the HTML elements on the page. Every element — every <p>, every <div>, every <span> — is represented in the DOM by a different object. (There are also global objects, like window and document, that aren’t tied to specific elements.)
      • All DOM objects share a set of common properties, but some objects have more than others. In browsers that support HTML5 features, certain objects will have unique properties. A quick peek at the DOM will tell you which features are supported.
    • Detecting HTML5 features ...
      • There are four basic techniques for detecting whether a browser supports a particular feature.
        • Check if a certain property exists on a global object (such as window or navigator).
        • Create an element, then check if a certain property exists on that element.
        • Create an element, check if a certain method exists on that element, then call the method and check the value it returns.
        • Create an element, set a property to a certain value, then check if the property has retained its value.
    • Detecting HTML5 features ...
      • Modernizr is an open source, MIT-licensed JavaScript library that detects support for many HTML5 & CSS3 features.
    • Detecting HTML5 features ...
    • Let's look in detail
      • From the top of HTML page … first element is “doctype.” tag was introduced by MS for backword compatibility for HTML pages in IE 5.
      • Before rendering a page, IE5/Mac looked at the “doctype,” which is typically the first line of the HTML source (even before the <html> element). Older pages (that relied on the rendering quirks of older browsers) generally didn’t have a doctype at all.
      • This idea spread like wildfire, and soon all major browsers had two modes: “quirks mode” and “standards mode.”
      • Later Mozilla introduced one more , called ”Almost Standards Mode”.
    • <!DOCTYPE >
      • Quirks Mode
      • In the Quirks mode, browsers violate contemporary Web format specifications in order to avoid “breaking” pages authored according to practices that were prevalent in the late 1990s.
      • Standards Mode
      • In the Standards mode, browsers try to give conforming documents the specification-wise correct treatment to the extent implemented in a particular browser. HTML5 calls this mode the “no quirks mode.”
      • Almost Standards Mode
      • Firefox, Safari, Chrome, Opera (since 7.5) and IE8 also have a mode known as “Almost Standards mode,” that implements the vertical sizing of table cells traditionally and not rigorously according to the CSS2 specification. HTML5 calls this mode the “limited quirks mode.”
    • <! DOCTYPE>
      • Now where were we?
      • <!DOCTYPE html
      • PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
      • &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;>
      • That happens to be one of the 15 doctypes that trigger “standards mode” in all modern browsers. There is nothing wrong with it. If you like it, you can keep it. Or you can change it to the HTML5 doctype, which is shorter and sweeter and also triggers “standards mode” in all modern browsers.
      • This is the HTML5 doctype:-
      • <!DOCTYPE html>
      • That’s it. Just 15 characters. It’s so easy, you can type it by hand and not screw it up.
    • Look Again <!DOCTYPE>
      • <html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;
      • lang=&quot;en&quot;
      • xml:lang=&quot;en&quot;>
      • xmlns attribute : - It says that elements in this page are in the XHTML namespace, http://www.w3.org/1999/xhtml. But elements in HTML5 are always in this namespace, so you no longer need to declare it explicitly.
      • Two more attributes:- lang and xml:lang, both define the language of this HTML page. (en stands for “English.”). Only the lang attribute has any effect in HTML5.
      • <html lang=&quot;en&quot;>
    • Other Link Relations in HTML5
      • The first child of the root element is usually the <head> element. The <head> element contains metadata:- information about the page.
      • <link rel=&quot;stylesheet&quot; href=&quot;style-original.css&quot; />
      • rel=&quot;archives&quot; “indicates that the referenced document describes a collection of records, documents, or other materials of historical interest. A blog’s index page could link to an index of the blog’s past posts with rel=&quot;archives&quot;.”
      • rel=&quot;author&quot; is used to link to information about the author of the page. This can be a mailto: address, though it doesn’t have to be. It could simply link to a contact form or “about the author” page.
      • rel=&quot;external&quot; “indicates that the link is leading to a document that is not part of the site that the current document forms a part of.” I believe it was first popularized by WordPress, which uses it on links left by commenters.
      • Few more … rel=&quot;tag&quot;,rel=&quot;sidebar&quot;,rel=&quot;search&quot;,rel=&quot;prefetch&quot;,rel=&quot;pingback&quot; ,rel=&quot;nofollow&quot;, rel=&quot;noreferrer&quot;,rel=&quot;license&quot;
    • New Semantic Elements in HTML5
      • <section>
      • The section element represents a generic document or application section. A section, in this context, is a thematic grouping of content, typically with a heading. Examples of sections would be chapters, the tabbed pages in a tabbed dialog box, or the numbered sections of a thesis. A Web site's home page could be split into sections for an introduction, news items, contact information.
      • <nav>
      • The nav element represents a section of a page that links to other pages or to parts within the page: a section with navigation links. Not all groups of links on a page need to be in a nav element — only sections that consist of major navigation blocks are appropriate for the nav element. In particular, it is common for footers to have a short list of links to common pages of a site, such as the terms of service, the home page, and a copyright page. The footer element alone is sufficient for such cases, without a nav element.
      • <article>
      • The article element represents a component of a page that consists of a self-contained composition in a document, page, application, or site and that is intended to be independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a Web log entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.
      • <aside>
      • The aside element represents a section of a page that consists of content that is tangentially related to the content around the aside element, and which could be considered separate from that content. Such sections are often represented as sidebars in printed typography. The element can be used for typographical effects like pull quotes or sidebars, for advertising, for groups of nav elements, and for other content that is considered separate from the main content of the page.
    • New Semantic Elements in HTML5 ...
      • <hgroup>
      • The hgroup element represents the heading of a section. The element is used to group a set of h1–h6 elements when the heading has multiple levels, such as subheadings, alternative titles, or taglines.
      • <header>
      • The header element represents a group of introductory or navigational aids. A header element is intended to usually contain the section’s heading (an h1–h6 element or an hgroup element), but this is not required. The header element can also be used to wrap a section’s table of contents, a search form, or any relevant logos.
      • <footer>
      • The footer element represents a footer for its nearest ancestor sectioning content or sectioning root element. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like. Footers don’t necessarily have to appear at the end of a section, though they usually do. When the footer element contains entire sections, they represent appendices, indexes, long colophons, verbose license agreements, and other such content.
      • <time>
      • The time element represents either a time on a 24 hour clock, or a precise date in the proleptic Gregorian calendar, optionally with a time and a time-zone offset.
      • <mark>
      • The mark element represents a run of text in one document marked or highlighted for reference purposes.
    • I know you’re anxious to start using these new elements … but wait ! Let's know how browsers handle unknown elements. [ of course IE issue ;) ]
      • Every browser has a master list of HTML elements that it supports. For example, Mozilla Firefox’s list is stored in http://mxr.mozilla.org/seamonkey/source/parser/htmlparser/src/nsElementTable.cpp
      • There are two fundamental problems with unknown elements:-
        • How should the element be styled? By default, <p> has spacing on the top and bottom, <blockquote> is indented with a left margin, and <h1> is displayed in a larger font.
        • What should the element’s DOM look like? Mozilla’s nsElementTable.cpp includes information about what kinds of other elements each element can contain. If you include markup like <p><p>, the second paragraph element implicitly closes the first one, so the elements end up as siblings, not parent-and-child. But if you write <p><span>, the span does not close the paragraph, because Firefox knows that <p> is a block element that can contain the inline element <span>. So, the <span> ends up as a child of the <p> in the DOM.
    • how browsers handle unknown elements ...
      • Different browsers answer these questions in different ways.
      • The first question should be relatively simple to answer: don’t give any special styling to unknown elements. Just let them inherit whatever CSS properties are in effect wherever they appear on the page, and let the page author specify all styling with CSS. Unfortunately, Internet Explorer (prior to version 9) does not allow styling on unknown elements.
      • <style type=&quot;text/css&quot;> article { display: block; border: 1px solid red } </style>
      • <article><h1>Welcome to Initech</h1> <p>This is your <span>first day</span>.</p></article>
      • Internet Explorer (up to and including IE 8) will not put a red border around the article.
      • The second problem is the DOM that browsers create when they encounter unknown elements. Again, the most problematic browser is Internet Explorer.
      • If IE doesn’t explicitly recognize the element name, it will insert the element into the DOM as an empty node with no children. All the elements that you would expect to be direct children of the unknown element will actually be inserted as siblings instead.
    • how browsers handle unknown elements ...
      • Solution !!?
      • If you create a dummy <article> element with JavaScript before you use it in your page, Internet Explorer will magically recognize the <article> element and let you style it with CSS.
    • IE hack for unknown elements
      • <html>
      • <head>
      • <style>
      • article { display: block; border: 1px solid red }
      • </style>
      • <script>document.createElement(&quot;article&quot;);</script>
      • </head>
      • <body>
      • <article>
      • <h1>Welcome to Initech</h1>
      • <p>This is your <span>first day</span>.</p>
      • </article>
      • </body>
      • </html>
    • IE hack for unknow elements
      • <!--[if lt IE 9]>
      • <script>
      • var e = (&quot;abbr,article,aside,audio,canvas,datalist,details,&quot; +
      • &quot;figure,footer,header,hgroup,mark,menu,meter,nav,output,&quot; +
      • &quot;progress,section,time,video&quot;).split(',');
      • for (var i = 0; i < e.length; i++) {
      • document.createElement(e[i]);
      • }
      • </script>
      • <![endif]-->
      • The <!--[if lt IE 9]> and <![endif]--> bits are conditional comments. Internet Explorer interprets them like an if statement: “if the current browser is a version of Internet Explorer less than version 9, then execute this block.” Every other browser will treat the entire block as an HTML comment. The net result is that Internet Explorer (up to and including version 8) will execute this script, but other browsers will ignore the script altogether. This makes your page load faster in browsers that don’t need this hack.
    • Dates and Times
      • <time datetime=&quot;2009-10-22&quot; pubdate>October 22, 2009</time>
      • If you want to include a time too, add the letter T after the date, then the time in 24-hour format, then a timezone offset.
      • <time datetime=&quot;2009-10-22T13:59:47-04:00&quot; pubdate>
      • October 22, 2009 1:59pm EDT
      • </time>
      • Pubdate is boolean flag it tells:-
      • If the <time> element is in an <article> element, it means that this timestamp is the publication date of the article. If the <time> element is not in an <article> element, it means that this timestamp is the publication date of the entire document.
    • the <canvas> element HTML 5's Magic
      • HTML 5 defines the <canvas> element as “a resolution-dependent bitmap canvas which can be used for rendering graphs, game graphics, or other visual images on the fly.” A canvas is a rectangle in your page where you can use JavaScript to draw anything you want.
      • IE* Firefox Safari Chrome Opera iPhone Android
      • 7.0+ 3.0+ 3.0+ 3.0+ 10.0+ 1.0+ 1.0+
      • Internet Explorer support requires the third-party explorercanvas http://code.google.com/p/explorercanvas/ library.
    • canvas
      • Board-drawing , art , gaming, chart , GUI presentation
      • http://spielzeugz.de/html5/liquid-particles.html
      • http://craftymind.com/factory/html5video/CanvasVideo.html
    • Back to HTML 5 - JS
      • New Selectors
      • var el = document.getElementById('section1'); el.focus();
      • var els = document.getElementsByTagName('div'); els[0].focus();
      • var els = document.getElementsByClassName('section'); els[0].focus();
      • Web Storage
      • textarea.addEventListener('keyup', function () {
      • window.localStorage['value'] = area.value;
      • window.localStorage['timestamp'] = (new Date()).getTime();
      • }, false);
      • textarea.value = window.localStorage['value'];
      • // Content will be available after browser refresh/reopen.
    • HTML5 - JS
      • Web SQL Database
      • var db = window.openDatabase(&quot;Database Name&quot;, &quot;Database Version&quot;);
      • db.transaction(function(tx) {
      • tx.executeSql(&quot;SELECT * FROM test&quot;, [], successCallback, errorCallback);
      • });
      • Application Cache API
      • <html manifest=&quot;cache-manifest&quot;>
      • window.applicationCache.addEventListener('checking', updateCacheStatus, false);
      • CACHE MANIFEST
      • # version 1
      • CACHE:-/html5/src/refresh.png,/html5/src/logic.js, /html5/src/style.css,/html5/src/background.png
      • // Turn off internet connection and refresh
    • HTML5-JS
      • Web Workers
      • main.js:
      • var worker = new Worker(‘extra_work.js'); worker.onmessage = function(event) { alert(event.data); };
      • extra_work.js:
      • /* do some work; when done post message.*/ postMessage(some_data);
      • Web Sockets
      • var socket = new WebSocket(location);
      • socket.onopen = function(event) {
      • socket.postMessage(“Hello, WebSocket”);
      • }
      • socket.onmessage = function(event) { alert(event.data); }
      • socket.onclose = function(event) { alert(“closed”); }
      • //Bi-directional, full-duplex communications channels, over a single Transmission Control Protocol (TCP) socket, designed to be implemented in web browsers and web servers.
    • HTML5-JS
      • Notifications
      • if (window.webkitNotifications.checkPermission() == 0) {
      • window.webkitNotifications.createNotification(tweet.picture, tweet.title, tweet.text).show();
      • } else { window.webkitNotifications.requestPermission(); }
      • Geolocation
      • if (navigator.geolocation) {
      • navigator.geolocation.getCurrentPosition(function(position) {
      • var lat = position.coords.latitude;
      • var lng = position.coords.longitude;
      • var options = { position: new google.maps.LatLng(lat, lng) }
      • var marker = new google.maps.Marker(options);
      • marker.setMap(map);
      • });
      • }
    • HTML5-HTML Forms
      • Dedicated UI:
      • <input type='range' min='0' max='50' value='0' />
      • <input results='10' type='search' />
      • <input type='text' placeholder='Search inside' />
      • Input Validation:
      • <style> :invalid { background-color: red; } </style>
      • <input type='color' />
      • <input type='number' />
      • <input type='email' />
      • <input type='tel' />
      • etc...
      • Not yet
      • <meter>,<progress>,<output> etc...
    • HTML5-HTML
      • Audio + Video
      • <audio src=&quot;sound.mp3&quot; controls></audio>
      • document.getElementById(&quot;audio&quot;).muted = false;
      • <video src='movie.mp4' autoplay controls></video>
      • document.getElementById(&quot;video&quot;).play();
    • HTML5-CSS
      • CSS Selectors
      • Image-like display
      • Div { display: inline-block; }
      • Specific attributes
      • input[type=&quot;text&quot;] { background: #eee; }
      • Negation
      • :not(.box) {
      • color: #00c;
      • }
      • More specific targetting
      • h2:first-child { ... }
    • HTML5-CSS
      • New font support
      • @font-face {
      • font-family: 'LeagueGothic';
      • src: url(LeagueGothic.otf);
      • }
      • Text wrapping
      • div {
      • text-overflow: ellipsis;
      • }
      • Columns
      • -webkit-column-count: 1;
      • -webkit-column-rule: 1px solid #bbb;
      • ;
      • Text stroke
      • div {
      • -webkit-text-fill-color: black;
      • -webkit-text-stroke-color: red;
      • -webkit-text-stroke-width: 0.00px;
      • }
      • Opacity
      • color: rgba(255, 0, 0, 1.00);
      • background: rgba(0, 0, 255, 0.32);
      • Rounded corners
      • border-radius: 0px;
    • HTML5-CSS
      • Gradients
      • background: -webkit-gradient(linear, left top, left bottom,
      • from(#00abeb), to(white),
      • color-stop(0.5, white), color-stop(0.5, #66cc00))
      • Shadows
      • text-shadow: rgba(0, 0, 0, 0.5) 0 7px 7px;
      • background:
      • -webkit-gradient(linear, left top, left bottom,
      • from(rgba(200, 200, 240, 0.86)), to(rgba(255, 255, 255, 0.86)));
      • border-radius: 50px;
      • -webkit-box-reflect: below 10px
      • -webkit-gradient(linear, left top, left bottom,
      • from(transparent), to(rgba(255, 255, 255, 0.69)));
      • Animations
      • @-webkit-keyframes pulse {
      • from {
      • opacity: 0.0;
      • font-size: 100%;
      • }
      • to {
      • opacity: 1.0;
      • font-size: 200%;
      • }
      • }
      • div {
      • -webkit-animation-name: pulse;
      • }
    • Browser Support
    • Check Your Browser
      • So many tools
    • Thanks
      • [email_address]