SlideShare una empresa de Scribd logo
1 de 40
Submitted by :-
Akash Tripathi
• HTML5 is a markup language for structuring and
  presenting content for the World Wide Web.
• HTML5 is the next major revision of the HTML
  standard superseding HTML 4.01, XHTML 1.0, and
  XHTML 1.1.
• HTML5 is a cooperation between the World Wide
  Web Consortium (W3C) and the Web Hypertext
  Application Technology Working Group
  (WHATWG).
• <!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML
  4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">




• <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict //EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">




• <!DOCTYPE html>
The <meta> tag
                                                  The <meta> tag
• <meta http-equiv="Content-
  Type"                                           • <meta charset="UTF-8">
  content="text/html;charset=UTF-
  8">


                                                   The <script> tag
The <script> tag                                   • <link rel="stylesheet"
• <script type="text/javascript“ src="file.js">      href="file.css">
  </script>
•   Content-editable
                        •   contextmenu
Elements   Attributes   •   draggable
                        •   dropzone
                        •   Hidden
                        • data
                        • spellcheck
Event handlers in Javascript or vbscript to specify values of event tag attribute.
    Attributes can be used to trigger any javascript or vbscript code of given value, when
    there is any event occurring for any HTML5 element.
    Documentation:-                  Action:-                   Media:-              Windows and forms:-


                                                               Oncanplay
 offline/online/onoffline        Onclick/ondbclick                                  Onabort/onblur/onfocus
                                                            oncanplaythrough
    onoine/ononline

                                Ondrag/ondragend        Onplay/onpause/onplaying       Onerror/oninvalid
onbeforeprint/onafterprint   ondragcenter/ondragleave
                              ondragover/ondragstart       Onemptied/onended
                                     ondrop                                        Onformchange/onforminput
 Onbeforeonload/onload
        onunload                                        Onloadeddata/onprogress
                              Onkeydown/onkeypress
                                                                                       Oninput/onsubmit
                                     onkeyup
                                                              Onratechange
      Onhaschange                                          onreadystatechange
                                  Onmousedown
                                                                                      Onpopstate/onresize
                                  onmousemove
                                                           Onseeked/onseeking
     Onredo/onundo                                      onsuspend/ontimeupdate
                             Onmouseout/onmouseover
                                                                                           onselect
                                   onmouseup
                                                        Onvolumechange/onwaiting
        Onstorage
                                 Onmousewheel
Web Form 2.0 provides a greater degree of semantic mark-up than
        HTML4 and remove a great deal of the need for tedious scripting and
        styling.

       New <input> new in HTML5
       <input> typesattributes in HTML5
                                                        Month            step
                                    readonly
                  min
   Color                     formaction
                                      Date          autocomplete          Time
                 week                     list
                                 Range
list             multiple                                          url     max
                                                 placeholder
        required       pattern             formenctype
 Search                                  Email
                                                         Tel
formnovalidate     Datetime-local
                         formmethod
                                  Datetime
   Number     form                             autofocus
Labels
<label for="inputID">Label: </label>
<input id="inputID" name="inputName" type="text" />


The value of the for attribute should match the value of the
input's id attribute
Attributes
<label for="inputID">Label: </label>
<input id="inputID" name="inputName"
placeholder="placeholder text"
pattern="w{6,9}"
required
autofocus
type="text"/>
<label for="inputID">Label: </label>
<input id="inputID" name="inputName"
placeholder="placeholder text"
pattern="w{6,9}"
required
autofocus
type="text"/>
form attribute
                  form="notMyParentForm"

          Note: form=" disassociates a form element from its parent form. “

               color attribute
               <input name="color"
               type="color" />




<input id="color"
name="color“
type="color"
placeholder="#FFFFFF"
pattern="#[0-9A-Fa-f]{6}"
required />
url attribute
              <input name="website" type="url" />

              <input
              id="website"
              name="url“
               type="url“
              placeholder="http://www.domain.com"
              pattern="(http|https|ftp)://[a-zA-Z0-9-./]*"/>




Different dynamic keyboards displayed
based on input type.
tel attribute
             <input name="telephone" type="tel" />

             <input
             id="phone"
             name="phone"
             type="tel"
             placeholder="415-555-1212"
             pattern="d{3}-d{3}-d{4}"/>




email attribute
<input name="address" type="email" />

<input
id="email"
name="email"
type="email"
placeholder="you@domain.com" multiple />
number attribute                     <input
            ‘number' specific attributes:        id="nickels"
            •min                                 type="number"
            •max                                 placeholder="0, 5, 10 …"
            •step                                pattern="[0-9]*[05]"
                                                 min="0"
                                                 max="1000"
                                                 step="5" />




range attribute
<input
 id="range"
name="range"
type="range"
placeholder="0 to 10"
pattern="[0-9]|10" min="0" max="10" step="1"/>
search attribute
     <form>
     <input name="q" type="search">
     <input type="submit" value="Go">
     </form>

date attribute
<form>
<input name="birthday" type="date">
<input type="submit" value="Go"> </form>

datetime attribute
<form>
<input name="t" type="datetime">
<input type="submit" value="Go"> </form>

week attribute
<form>
<input name="w" type="week">
<input type="submit" value="Go"> </form>

time attribute
<form>
<input name="t" type="time">
<input type="submit" value="Go"> </form>
validation attribute
         var validityObject = document.getElementById['form_control'].validity;




Examples:-                                      Styling:-
validityObject.valueMissing                     ::-webkit-validation-bubble {}
validityObject.typeMismatch                     ::-webkit-validation-bubble-arrow-clipper {}
validityObject.patternMismatch                  ::-webkit-validation-bubble-arrow {}
validityObject.tooLong                          ::-webkit-validation-bubble-message {}
validityObject.rangeUnderflow
validityObject.rangeOverflow
validityObject.stepMismatch
validityObject.valid
validityObject.customError
<meter>, <progress> & <output> attribute
Example:-

<meter value=75 min=0 max=100 >75% full</meter>




<progress>loading...</progress>




<progress value="75" max="100">75% complete</progress>




<output>
Speech Input attribute

<input type="text" x-webkit-speech />




Developed for you in parts by
Persistent local storage is one of the areas where native
client applications have held an advantage over web
applications. For native applications, the operating
system typically provides an abstraction layer for storing
and retrieving application-specific data like preferences
or runtime state.




                               Logo for localstorage
Implementation


function supports_html5_storage() {
 try {
         return 'localStorage' in window &&
         window['localStorage'] !== null;
 } catch (e) {
          return false;
         }
 }
For receiving and storing
interface Storage {
          getter any getItem(in DOMString key);
          setter creator void setItem(in DOMString key, in any
data);
};

var foo = localStorage.getItem("bar");
 // ... localStorage.setItem("bar", foo);

For removing

interface Storage {
          deleter void removeItem(in DOMString key);
          void clear();
};

For total number of values

interface Storage {
          readonly attribute unsigned long length;
           getter DOMString key(in unsigned long index);
};
Property   Type     Description
key        string   the named key that was added, removed, or modified

                    the previous value (now overwritten), or null if a new item was
oldValue   any
                    added

newValue   any      the new value, or null if an item was removed

url*       string   the page which called a method that triggered this change
var Socket = new WebSocket(url, [protocal] );


Attributes
Socket.readyState
Socket.bufferedAmount
Events
Open Socket.onopen
Message Socket.onmessage
Error Socket.onerror
Close Socket.onclose
Methods
Socket.send()
Socket.close()
// Let us open a web socket
        var ws = new WebSocket("ws://localhost:9998/echo");
        ws.onopen = function() {
        // Web Socket is connected, send data using send()
        ws.send("Message to send");
        alert("Message is sent...");

        ws.onmessage = function (evt) {
                    var received_msg = evt.data;
                   alert("Message is received...");
        };
         ws.onclose = function() {
// websocket is closed. alert("Connection is closed...");
        };
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.

       Simple shapes
function draw_b() {
        var b_canvas = document.getElementById("b");
        var b_context = b_canvas.getContext("2d");
        b_context.fillRect(50, 25, 150, 100);
}


var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.moveTo(0,0);
ctx.lineTo(300,150);
ctx.stroke();
var c=document.getElementById("myCanvas");
       var ctx=c.getContext("2d");
       ctx.beginPath();
       ctx.arc(95,50,40,0,2*Math.PI);
       ctx.stroke();


       var c=document.getElementById("myCanvas");
       var ctx=c.getContext("2d");
       ctx.font="30px Arial";
       ctx.fillText("Hello World",10,50);
       / ctx.strokeText("Hello World",10,50);

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");

// Create gradient
var grd=ctx.createLinearGradient(0,0,200,0);
/ var grd=ctx.createRadialGradient(75,50,5,90,60,100);
grd.addColorStop(0,"red");
grd.addColorStop(1,"white");

// Fill with gradient
ctx.fillStyle=grd;
ctx.fillRect(10,10,150,80);
<img id="cat" src="images/cat.png" alt="sleeping cat“
width="177" height="113">
<canvas id="e" width="177" height="113">
</canvas>


drawImage(image,dx,dy)
drawImage(image,dx,dy, dw, dh)
drawImage(image, , sx, sy, sw, sh, dx, dy, dw, dh)
The geolocation API lets you share your location
        with trusted web sites.

The geolocation API centers around a new property on the global navigator
object: navigator.geolocation.
The simplest use of the geolocation API looks like this:

                   function get_location() {
                   navigator.geolocation.getCurrentPosition(show_
                   map); }




                   function show_map(position) {
                             var latitude = position.coords.latitude;
                             var longitude = position.coords.longitude;
                             // let's show a map!
                    }
Property                  Type             Notes
coords.latitude           double           decimal degrees
coords.longitude          double           decimal degrees
                                           meters above the reference
coords.altitude           double or null
                                           ellipsoid
coords.accuracy           double           meters
coords.altitudeAccuracy   double or null   meters
                                           degrees clockwise from true
coords.heading            double or null
                                           north
coords.speed              double or null   meters/second
timestamp                 DOMTimeStamp     like a Date() object
Microdata is a standardized way to provide additional
semantics in your web pages.


 <div itemscope>
 <p>My name is <span
 itemprop="name">Zara</span>.</p> </div>
 <div itemscope>
 <p>My name is <span
 itemprop="name">Nuha</span>.</p>
 </div>
Drag and drop is a very common feature. It is when you
  "grab" an object and drag it to a different location.


<img draggable="true">

function drag(ev)
{
ev.dataTransfer.setData("Text",ev.target.id);     event.preventDefault()
}

           function drop(ev)
           {
           ev.preventDefault();
           var data=ev.dataTransfer.getData("Text");
           ev.target.appendChild(document.getElementById(data));
           }
<video src=myVideo.ogv
     width=320 height=240
     controls poster=image.jpg>
     </video>

<video src=myVideo.ogv
width=320 height=240
controls poster=image.jpg>
Download my awesome video in
<a href=myVideo.ogg>Ogg</a>
or <a href=myVideo.mp4>MP4</a> format </video>


     <audio src="audio.mp3“
     controls preload>
     </audio>
HTML5 can be used as an alternative to Adobe Flash.
•Stability, faster processes and sponsorship deals.
•WHATWG/W3C 'split'?
•W3C work to ensure the spec doesn't become forked
•How soon will HTML5 become a 'stable standard'? Targeting
2014…!!!
•Browser vendors rapidly providing updates
•Sponsorship deal for w3c
The End

Más contenido relacionado

La actualidad más candente

Creating GUI container components in Angular and Web Components
Creating GUI container components in Angular and Web ComponentsCreating GUI container components in Angular and Web Components
Creating GUI container components in Angular and Web ComponentsRachael L Moore
 
Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3Todd Zaki Warfel
 
Polymer - pleasant client-side programming with web components
Polymer - pleasant client-side programming with web componentsPolymer - pleasant client-side programming with web components
Polymer - pleasant client-side programming with web componentspsstoev
 
How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic templatevathur
 
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective, Ajax ...
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective,  Ajax ...The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective,  Ajax ...
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective, Ajax ...Nicole Sullivan
 
AJAX Workshop Notes
AJAX Workshop NotesAJAX Workshop Notes
AJAX Workshop NotesPamela Fox
 
Maintainable JavaScript 2012
Maintainable JavaScript 2012Maintainable JavaScript 2012
Maintainable JavaScript 2012Nicholas Zakas
 
HTML & CSS Workshop Notes
HTML & CSS Workshop NotesHTML & CSS Workshop Notes
HTML & CSS Workshop NotesPamela Fox
 
1. introduction to html5
1. introduction to html51. introduction to html5
1. introduction to html5JayjZens
 
Kakunin E2E framework showcase
Kakunin E2E framework showcaseKakunin E2E framework showcase
Kakunin E2E framework showcaseThe Software House
 
Getting Started with DOM
Getting Started with DOMGetting Started with DOM
Getting Started with DOMHernan Mammana
 
Rapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with BootstrapRapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with BootstrapJosh Jeffryes
 
Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101Ted Kulp
 
Front End Good Practices
Front End Good PracticesFront End Good Practices
Front End Good PracticesHernan Mammana
 

La actualidad más candente (20)

Html5 ux london
Html5 ux londonHtml5 ux london
Html5 ux london
 
Creating GUI container components in Angular and Web Components
Creating GUI container components in Angular and Web ComponentsCreating GUI container components in Angular and Web Components
Creating GUI container components in Angular and Web Components
 
Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3
 
Polymer - pleasant client-side programming with web components
Polymer - pleasant client-side programming with web componentsPolymer - pleasant client-side programming with web components
Polymer - pleasant client-side programming with web components
 
How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic template
 
HTML CSS & Javascript
HTML CSS & JavascriptHTML CSS & Javascript
HTML CSS & Javascript
 
Advanced Json
Advanced JsonAdvanced Json
Advanced Json
 
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective, Ajax ...
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective,  Ajax ...The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective,  Ajax ...
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective, Ajax ...
 
AJAX Workshop Notes
AJAX Workshop NotesAJAX Workshop Notes
AJAX Workshop Notes
 
Maintainable JavaScript 2012
Maintainable JavaScript 2012Maintainable JavaScript 2012
Maintainable JavaScript 2012
 
HTML & CSS Workshop Notes
HTML & CSS Workshop NotesHTML & CSS Workshop Notes
HTML & CSS Workshop Notes
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
1. introduction to html5
1. introduction to html51. introduction to html5
1. introduction to html5
 
Java script
Java scriptJava script
Java script
 
Kakunin E2E framework showcase
Kakunin E2E framework showcaseKakunin E2E framework showcase
Kakunin E2E framework showcase
 
Getting Started with DOM
Getting Started with DOMGetting Started with DOM
Getting Started with DOM
 
Rapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with BootstrapRapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with Bootstrap
 
Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101
 
Front End Good Practices
Front End Good PracticesFront End Good Practices
Front End Good Practices
 
Polymer 1.0
Polymer 1.0Polymer 1.0
Polymer 1.0
 

Similar a Html5

Repaso rápido a los nuevos estándares web
Repaso rápido a los nuevos estándares webRepaso rápido a los nuevos estándares web
Repaso rápido a los nuevos estándares webPablo Garaizar
 
HTML5 - The 2012 of the Web
HTML5 - The 2012 of the WebHTML5 - The 2012 of the Web
HTML5 - The 2012 of the WebRobert Nyman
 
What you need to know bout html5
What you need to know bout html5What you need to know bout html5
What you need to know bout html5Kevin DeRudder
 
HTML5 Forms - KISS time - Fronteers
HTML5 Forms - KISS time - FronteersHTML5 Forms - KISS time - Fronteers
HTML5 Forms - KISS time - FronteersRobert Nyman
 
HTML5 - The 2012 of the Web - Adobe MAX
HTML5 - The 2012 of the Web - Adobe MAXHTML5 - The 2012 of the Web - Adobe MAX
HTML5 - The 2012 of the Web - Adobe MAXRobert Nyman
 
Spring Web Service, Spring Integration and Spring Batch
Spring Web Service, Spring Integration and Spring BatchSpring Web Service, Spring Integration and Spring Batch
Spring Web Service, Spring Integration and Spring BatchEberhard Wolff
 
Javascript MVC & Backbone Tips & Tricks
Javascript MVC & Backbone Tips & TricksJavascript MVC & Backbone Tips & Tricks
Javascript MVC & Backbone Tips & TricksHjörtur Hilmarsson
 
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference ZürichHTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference ZürichRobert Nyman
 
Model-Driven Software Development - Strategies for Design & Implementation of...
Model-Driven Software Development - Strategies for Design & Implementation of...Model-Driven Software Development - Strategies for Design & Implementation of...
Model-Driven Software Development - Strategies for Design & Implementation of...Eelco Visser
 
Strategies for Design & Implementation of Domain-Specific Languages
Strategies for Design & Implementation of Domain-Specific LanguagesStrategies for Design & Implementation of Domain-Specific Languages
Strategies for Design & Implementation of Domain-Specific LanguagesEelco Visser
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaAgile Testing Alliance
 
HTML5 e Css3 - 7 | WebMaster & WebDesigner
HTML5 e Css3 - 7 | WebMaster & WebDesignerHTML5 e Css3 - 7 | WebMaster & WebDesigner
HTML5 e Css3 - 7 | WebMaster & WebDesignerMatteo Magni
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to TornadoGavin Roy
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup PerformanceJustin Cataldo
 
Ch1(introduction to php)
Ch1(introduction to php)Ch1(introduction to php)
Ch1(introduction to php)Chhom Karath
 
Introduction to Yesod
Introduction to YesodIntroduction to Yesod
Introduction to Yesodbobjlong
 

Similar a Html5 (20)

Repaso rápido a los nuevos estándares web
Repaso rápido a los nuevos estándares webRepaso rápido a los nuevos estándares web
Repaso rápido a los nuevos estándares web
 
HTML 5 - Overview
HTML 5 - OverviewHTML 5 - Overview
HTML 5 - Overview
 
Introduccion a HTML5
Introduccion a HTML5Introduccion a HTML5
Introduccion a HTML5
 
html5
html5html5
html5
 
HTML5 - The 2012 of the Web
HTML5 - The 2012 of the WebHTML5 - The 2012 of the Web
HTML5 - The 2012 of the Web
 
What you need to know bout html5
What you need to know bout html5What you need to know bout html5
What you need to know bout html5
 
HTML5 Forms - KISS time - Fronteers
HTML5 Forms - KISS time - FronteersHTML5 Forms - KISS time - Fronteers
HTML5 Forms - KISS time - Fronteers
 
HTML5 - The 2012 of the Web - Adobe MAX
HTML5 - The 2012 of the Web - Adobe MAXHTML5 - The 2012 of the Web - Adobe MAX
HTML5 - The 2012 of the Web - Adobe MAX
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
Spring Web Service, Spring Integration and Spring Batch
Spring Web Service, Spring Integration and Spring BatchSpring Web Service, Spring Integration and Spring Batch
Spring Web Service, Spring Integration and Spring Batch
 
Javascript MVC & Backbone Tips & Tricks
Javascript MVC & Backbone Tips & TricksJavascript MVC & Backbone Tips & Tricks
Javascript MVC & Backbone Tips & Tricks
 
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference ZürichHTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
 
Model-Driven Software Development - Strategies for Design & Implementation of...
Model-Driven Software Development - Strategies for Design & Implementation of...Model-Driven Software Development - Strategies for Design & Implementation of...
Model-Driven Software Development - Strategies for Design & Implementation of...
 
Strategies for Design & Implementation of Domain-Specific Languages
Strategies for Design & Implementation of Domain-Specific LanguagesStrategies for Design & Implementation of Domain-Specific Languages
Strategies for Design & Implementation of Domain-Specific Languages
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh Gundecha
 
HTML5 e Css3 - 7 | WebMaster & WebDesigner
HTML5 e Css3 - 7 | WebMaster & WebDesignerHTML5 e Css3 - 7 | WebMaster & WebDesigner
HTML5 e Css3 - 7 | WebMaster & WebDesigner
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to Tornado
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
 
Ch1(introduction to php)
Ch1(introduction to php)Ch1(introduction to php)
Ch1(introduction to php)
 
Introduction to Yesod
Introduction to YesodIntroduction to Yesod
Introduction to Yesod
 

Html5

  • 2.
  • 3. • HTML5 is a markup language for structuring and presenting content for the World Wide Web. • HTML5 is the next major revision of the HTML standard superseding HTML 4.01, XHTML 1.0, and XHTML 1.1. • HTML5 is a cooperation between the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG).
  • 4.
  • 5.
  • 6. • <!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> • <!DOCTYPE html>
  • 7. The <meta> tag The <meta> tag • <meta http-equiv="Content- Type" • <meta charset="UTF-8"> content="text/html;charset=UTF- 8"> The <script> tag The <script> tag • <link rel="stylesheet" • <script type="text/javascript“ src="file.js"> href="file.css"> </script>
  • 8. Content-editable • contextmenu Elements Attributes • draggable • dropzone • Hidden • data • spellcheck
  • 9.
  • 10. Event handlers in Javascript or vbscript to specify values of event tag attribute. Attributes can be used to trigger any javascript or vbscript code of given value, when there is any event occurring for any HTML5 element. Documentation:- Action:- Media:- Windows and forms:- Oncanplay offline/online/onoffline Onclick/ondbclick Onabort/onblur/onfocus oncanplaythrough onoine/ononline Ondrag/ondragend Onplay/onpause/onplaying Onerror/oninvalid onbeforeprint/onafterprint ondragcenter/ondragleave ondragover/ondragstart Onemptied/onended ondrop Onformchange/onforminput Onbeforeonload/onload onunload Onloadeddata/onprogress Onkeydown/onkeypress Oninput/onsubmit onkeyup Onratechange Onhaschange onreadystatechange Onmousedown Onpopstate/onresize onmousemove Onseeked/onseeking Onredo/onundo onsuspend/ontimeupdate Onmouseout/onmouseover onselect onmouseup Onvolumechange/onwaiting Onstorage Onmousewheel
  • 11. Web Form 2.0 provides a greater degree of semantic mark-up than HTML4 and remove a great deal of the need for tedious scripting and styling. New <input> new in HTML5 <input> typesattributes in HTML5 Month step readonly min Color formaction Date autocomplete Time week list Range list multiple url max placeholder required pattern formenctype Search Email Tel formnovalidate Datetime-local formmethod Datetime Number form autofocus
  • 12. Labels <label for="inputID">Label: </label> <input id="inputID" name="inputName" type="text" /> The value of the for attribute should match the value of the input's id attribute
  • 13. Attributes <label for="inputID">Label: </label> <input id="inputID" name="inputName" placeholder="placeholder text" pattern="w{6,9}" required autofocus type="text"/>
  • 14. <label for="inputID">Label: </label> <input id="inputID" name="inputName" placeholder="placeholder text" pattern="w{6,9}" required autofocus type="text"/>
  • 15. form attribute form="notMyParentForm" Note: form=" disassociates a form element from its parent form. “ color attribute <input name="color" type="color" /> <input id="color" name="color“ type="color" placeholder="#FFFFFF" pattern="#[0-9A-Fa-f]{6}" required />
  • 16. url attribute <input name="website" type="url" /> <input id="website" name="url“ type="url“ placeholder="http://www.domain.com" pattern="(http|https|ftp)://[a-zA-Z0-9-./]*"/> Different dynamic keyboards displayed based on input type.
  • 17. tel attribute <input name="telephone" type="tel" /> <input id="phone" name="phone" type="tel" placeholder="415-555-1212" pattern="d{3}-d{3}-d{4}"/> email attribute <input name="address" type="email" /> <input id="email" name="email" type="email" placeholder="you@domain.com" multiple />
  • 18. number attribute <input ‘number' specific attributes: id="nickels" •min type="number" •max placeholder="0, 5, 10 …" •step pattern="[0-9]*[05]" min="0" max="1000" step="5" /> range attribute <input id="range" name="range" type="range" placeholder="0 to 10" pattern="[0-9]|10" min="0" max="10" step="1"/>
  • 19. search attribute <form> <input name="q" type="search"> <input type="submit" value="Go"> </form> date attribute <form> <input name="birthday" type="date"> <input type="submit" value="Go"> </form> datetime attribute <form> <input name="t" type="datetime"> <input type="submit" value="Go"> </form> week attribute <form> <input name="w" type="week"> <input type="submit" value="Go"> </form> time attribute <form> <input name="t" type="time"> <input type="submit" value="Go"> </form>
  • 20. validation attribute var validityObject = document.getElementById['form_control'].validity; Examples:- Styling:- validityObject.valueMissing ::-webkit-validation-bubble {} validityObject.typeMismatch ::-webkit-validation-bubble-arrow-clipper {} validityObject.patternMismatch ::-webkit-validation-bubble-arrow {} validityObject.tooLong ::-webkit-validation-bubble-message {} validityObject.rangeUnderflow validityObject.rangeOverflow validityObject.stepMismatch validityObject.valid validityObject.customError
  • 21. <meter>, <progress> & <output> attribute Example:- <meter value=75 min=0 max=100 >75% full</meter> <progress>loading...</progress> <progress value="75" max="100">75% complete</progress> <output>
  • 22. Speech Input attribute <input type="text" x-webkit-speech /> Developed for you in parts by
  • 23. Persistent local storage is one of the areas where native client applications have held an advantage over web applications. For native applications, the operating system typically provides an abstraction layer for storing and retrieving application-specific data like preferences or runtime state. Logo for localstorage
  • 24. Implementation function supports_html5_storage() { try { return 'localStorage' in window && window['localStorage'] !== null; } catch (e) { return false; } }
  • 25. For receiving and storing interface Storage { getter any getItem(in DOMString key); setter creator void setItem(in DOMString key, in any data); }; var foo = localStorage.getItem("bar"); // ... localStorage.setItem("bar", foo); For removing interface Storage { deleter void removeItem(in DOMString key); void clear(); }; For total number of values interface Storage { readonly attribute unsigned long length; getter DOMString key(in unsigned long index); };
  • 26. Property Type Description key string the named key that was added, removed, or modified the previous value (now overwritten), or null if a new item was oldValue any added newValue any the new value, or null if an item was removed url* string the page which called a method that triggered this change
  • 27. var Socket = new WebSocket(url, [protocal] ); Attributes Socket.readyState Socket.bufferedAmount Events Open Socket.onopen Message Socket.onmessage Error Socket.onerror Close Socket.onclose Methods Socket.send() Socket.close()
  • 28. // Let us open a web socket var ws = new WebSocket("ws://localhost:9998/echo"); ws.onopen = function() { // Web Socket is connected, send data using send() ws.send("Message to send"); alert("Message is sent..."); ws.onmessage = function (evt) { var received_msg = evt.data; alert("Message is received..."); }; ws.onclose = function() { // websocket is closed. alert("Connection is closed..."); };
  • 29. 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. Simple shapes function draw_b() { var b_canvas = document.getElementById("b"); var b_context = b_canvas.getContext("2d"); b_context.fillRect(50, 25, 150, 100); } var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.moveTo(0,0); ctx.lineTo(300,150); ctx.stroke();
  • 30. var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.beginPath(); ctx.arc(95,50,40,0,2*Math.PI); ctx.stroke(); var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.font="30px Arial"; ctx.fillText("Hello World",10,50); / ctx.strokeText("Hello World",10,50); var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); // Create gradient var grd=ctx.createLinearGradient(0,0,200,0); / var grd=ctx.createRadialGradient(75,50,5,90,60,100); grd.addColorStop(0,"red"); grd.addColorStop(1,"white"); // Fill with gradient ctx.fillStyle=grd; ctx.fillRect(10,10,150,80);
  • 31. <img id="cat" src="images/cat.png" alt="sleeping cat“ width="177" height="113"> <canvas id="e" width="177" height="113"> </canvas> drawImage(image,dx,dy) drawImage(image,dx,dy, dw, dh) drawImage(image, , sx, sy, sw, sh, dx, dy, dw, dh)
  • 32. The geolocation API lets you share your location with trusted web sites. The geolocation API centers around a new property on the global navigator object: navigator.geolocation. The simplest use of the geolocation API looks like this: function get_location() { navigator.geolocation.getCurrentPosition(show_ map); } function show_map(position) { var latitude = position.coords.latitude; var longitude = position.coords.longitude; // let's show a map! }
  • 33. Property Type Notes coords.latitude double decimal degrees coords.longitude double decimal degrees meters above the reference coords.altitude double or null ellipsoid coords.accuracy double meters coords.altitudeAccuracy double or null meters degrees clockwise from true coords.heading double or null north coords.speed double or null meters/second timestamp DOMTimeStamp like a Date() object
  • 34. Microdata is a standardized way to provide additional semantics in your web pages. <div itemscope> <p>My name is <span itemprop="name">Zara</span>.</p> </div> <div itemscope> <p>My name is <span itemprop="name">Nuha</span>.</p> </div>
  • 35. Drag and drop is a very common feature. It is when you "grab" an object and drag it to a different location. <img draggable="true"> function drag(ev) { ev.dataTransfer.setData("Text",ev.target.id); event.preventDefault() } function drop(ev) { ev.preventDefault(); var data=ev.dataTransfer.getData("Text"); ev.target.appendChild(document.getElementById(data)); }
  • 36. <video src=myVideo.ogv width=320 height=240 controls poster=image.jpg> </video> <video src=myVideo.ogv width=320 height=240 controls poster=image.jpg> Download my awesome video in <a href=myVideo.ogg>Ogg</a> or <a href=myVideo.mp4>MP4</a> format </video> <audio src="audio.mp3“ controls preload> </audio>
  • 37. HTML5 can be used as an alternative to Adobe Flash.
  • 38.
  • 39. •Stability, faster processes and sponsorship deals. •WHATWG/W3C 'split'? •W3C work to ensure the spec doesn't become forked •How soon will HTML5 become a 'stable standard'? Targeting 2014…!!! •Browser vendors rapidly providing updates •Sponsorship deal for w3c