Professional Documents
Culture Documents
HTML5 is the latest and most enhanced version of HTML. Technically, HTML is not a programming
language, but rather a markup language.
HTML5 is the next major revision of the HTML standard superseding HTML 4.01, XHTML 1.0, and
XHTML 1.1. HTML5 is a standard for structuring and presenting content on the World Wide Web.
HTML5 is a cooperation between the World Wide Web Consortium (W3C) and the Web Hypertext
Application Technology Working Group (WHATWG).
The new standard incorporates features like video playback and drag-and-drop that have been
previously dependent on third-party browser plug-ins such as Adobe Flash, Microsoft Silverlight, and
Google Gears.
Tools
Syntax
The HTML 5 language has a "custom" HTML syntax that is compatible with HTML 4 and
XHTML1 documents published on the Web, but is not compatible with the more esoteric
SGML features of HTML 4
HTML 5 does not have the same syntax rules as XHTML where we needed lower case tag
names, quoting our attributes,an attribute had to have a value and to close all empty elements.
But HTML5 is coming with lots of flexibility and would support the followings:
Uppercase tag names.
Quotes are optional for attributes.
Attribute values are optional.
Closing empty elements are optional.
1.The DOCTYPE:
DOCTYPEs in older versions of HTML were longer because the HTML language was SGML based
and therefore required a reference to a DTD.
2.Character Encoding:
HTML 5 authors can use simple syntax to specify Character Encoding as follows:
<meta charset="UTF-8">
All the above syntax is case-insensitive.
HTML5 vs HTML4
header,
summary,
aside,
hgroup,
time,
audio,
keygen,
vidio
canvas,
mark,
command,
meter,
datalist,
nav,
details,
output,
embed,
progress,
figcaption,
rp, ruby,
figure,
section,
footer,
source,
Forms in html5
Integrated APIs
Audio
Video
Offline apps
Editable
Drag & Drop
History
PROTOCOLS
Associated APIs
Geolocation
Massaging
Section
Article
Aside
Header
Hgroup
Footer
Nav
Content tags
Figure
Video
Audio
Embed
Canvas
<section></section>
Output:-
</section>
<article></article>
This article element represents 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 blog entry, a user submitted comment,
an interactive widget or gadget, entry, a user submitted comment, an interactive widget or gadget, or
any other independent item of content
Code:<article>
<h4>Articale</h4>
<p>This article element represents a selfcontained composition in .....
</p>
<p>This could be a forum post a magazine or
newspaper article, a blog entry, a user
submitted comment, an interactive widget ...
</p>
</article>
Output:-
<aside></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
Code:<aside>
<h4>Epcot Center</h4>
<p>The Epcot Center is a theme park in
Disney World, Florida.</p>
</aside>
Output:-
<header></header>
Code:<header>
<h1>header</h1>
<p>The header element can also be used to wrap
a section's table of contents, a search form, or any
relevant logos.
</p>
</header>
Output:-
<hgroup></hgroup>
Code:-
<hgroup>
<h1>TOPS</h1>
<h2>TOPS</h2>
</hgroup>
Output:-
<footer></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 a s who wrote it. Links to related
documents. Copyright data and the like.
Code:-
Output:-
<footer>
Copyright 2013 TOPS Technologies
</footer>
<nav></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 links of a document must be in a <nav> element. The <nav> element is intended only for
major block of navigation links.
Browsers, such as screen readers for disabled users, can use this element to determine whether to
omit the initial rendering of this content.
Code:<nav>
<a href="/css/" target="_blank">CSS</a> |
<a href="/html/" target="_blank">HTML</a>
|
<a href="/javascript/"
target="_blank">JavaScript</a> |
<a href="/sql/tutorial/"
target="_blank">SQL</a>
</nav>
Output:-
<figure></figure>
The figure element represents some flow content, optionally with a caption that is self contained and
is typically referenced as a single unit from the main flow of the document.
The element can thus be used to ammotate illustrations, diagrams, photos, code listing, etc., that are
referred to from the main content photos, code listing, etc., that are referred to from the main
content of the document, but that could, without affecting the flow of the document, be moved away
from that primary content e.g. to the side of the page, to dedicated pages, or to an appendix
Code:<figure>
<figcaption>TOPS Technologies</figcaption>
<img src=logo.jpg" alt=TOPS Technologes"
width="304" height="228">
</figure>
Output:-
<video></video>
Is a media element whose media data is ostensibly video data, possibly with associated audio data.
Output:-
<audio></audio>
The audio element is a media element whose media data is ostensibly audio data.
Code:<audio controls>
<source src="tops.ogg" type="audio/ogg">
<source src="tops.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>
Output:-
<embed></embed>
The embed element represents an integration point for an external (typically non HTML) application
or interactive content
Code:<embed src="helloworld.swf">
Output:-
<canvas></canvas>
Providing scripts with a resolution dependent bitmap canvas, which can be used for rendering graphs,
game graphics, or other visual images on the fly.
Output:-
Rectangle
ctx.fillStyle="#FF0000";
ctx.fillRect(0,0,150,75); (fillRect(x,y,width,height))
Output:-
Circle
arc(95,50,40,0,2 (arc(x,y,r,start,stop))
Code:<script>
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.beginPath();
ctx.arc(95,50,40,0,2*Math.PI);
ctx.stroke();
</script>
Output:-
Code:<<script type="application/x-javascript">
function displayCanvas()
{
var canvas =
document.getElementById("myCanvas");
if (canvas.getContext) {
var ctx = canvas.getContext("2d");
ctx.fillStyle = "rgb(200,0,0)";
ctx.fillRect (0, 0, 150, 75);
ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
ctx.fillRect (40, 30, 125, 75);
} }
</script>
</head>
<body onload="displayCanvas();">
<canvas id="myCanvas" width="300"
height="200">Your browser does not support the
canvas tag. At the time of writing, Firefox, Opera,
and Chrome support this tag.</p>
<p>Here's an <a
href="/pix/html_5/tags/html_canvas_tag.gif">ima
ge of what it's supposed to look
like</a>.</canvas>
</body>
</html>
Output:-
<meter></meter>
The meter element represents a scalar measurement within a known range or a fractional value for
example disk usage the relevance of a query result, or the fraction of a voting population to have
selected a particular candidate.
This is also known as a gauge.
Code:<meter value="2" min="0" max="10">2 out of
10</meter><br><br><br>
<meter value="0.6">60%</meter>
Output:-
<progress></progress>
Output:-
<time></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.
this element is intended as a way to encode modern dates and times in a machine readable way so
that, for example, user agents can offer to add birthday reminders or scheduled events to the user's
calendar
Code:<p>On Saturdays, we open at
<time>09:00</time>.</p>
<p>The concert is <time datetime="2009-0218">next Wednesday</time>.</p>
<p>We finally hit the road at <time
datetime="2009-02-17T05:00-07:00">5am last
Tuesday</time>.</p>
Output:-
<details></details>
The details element represents a disclisure widget form which the user can obtain additional
information or controls.
Code:<details open="open">
<p>If your browser supports this element, it
should allow you to expand and collapse these
details.</p></details>
Output:-
<command></command>
The command element represents a command that the user can invoke.
Code:<script>
function save()
{
alert("Some javaScript....");
}
</script>
</head>
<body>
<menu>
<command type="command" label="Save"
onclick="save()">Save</command>
</menu>
<p><b>Note:</b> The command element is
currently only supported in IE9.</p>
</body>
</html>
Output:-
<menu></menu>
Output:-
Output:Code:-
The color type is used for input fields that should contain a color.
Output:Code:-
The datetime type allows the user to select a date and time
(with time zone).
Output:Code:-
<input type=datetime-local"
name=datetime">
The email type is used for input fields that should contain an e-mail address
Output:Code:-
<form action="demo_form.asp">
E-mail: <input type="email" name="email">
<input type="submit">
</form>
The month type allows the user to select a month and year.
Output:Code:-
The number type is used for input fields that should contain a numeric value. You can also set
restrictions on what numbers are accepted:
Max, Min, Set, Value
Output:Code:-
<form action="demo_form.asp">
Quantity (between 1 and 5): <input
type="number" name="quantity" min="1"
max="5">
<input type="submit">
</form>
The range type is used for input fields that should contain a value from a range of numbers. You can
also set restrictions on what numbers are accepted.
Output:Code:-
<form action="demo_form.asp"
method="get">
Points: <input type="range" name="points"
min="1" max="10">
<input type="submit">
</form>
Output:Code:-
<form action=index.html">
Search : <input type="search"
name=s"><br>
<input type="submit">
</form>
Output:Code:<form action="demo_form.asp">
Select a time: <input type="time"
name="usr_time">
<input type="submit">
</form>
The url type is used for input fields that should contain a URL address. The value of the url field is
automatically validated when the form is submitted
Output:Code:<form action="demo_form.asp">
Add your homepage: <input type="url"
name="homepage"><br>
<input type="submit">
</form>
The week type allows the user to select a week and year.
Output:Code:<form action="demo_form.asp">
Select a week: <input type="week"
name="year_week">
<input type="submit">
</form>
Output:Code:<form action="demo_form.asp"
autocomplete="on">
First name:<input type="text"
name="fname"><br>
Last name: <input type="text"
name="lname"><br>
E-mail: <input type="email" name="email"
autocomplete="off"><br>
<input type="submit">
</form>
Accept:- Specifies the types of files that the server accepts (only for type="file")
Output:Code:<form action="demo_form.asp">
<input type="file" name="pic"
accept="image/*">
<input type="submit">
</form>
Specifies that an <input> element should automatically get focus when the page loads
Output:Code:<form action="demo_form.asp">
First name: <input type="text"
name="fname" ><br>
Last name: <input type="text"
name="lname" autofocus><br>
<input type="submit">
</form>
Code:-
Output:-
Specifies the URL of the file that will process the input control when the form is submitted (for
type="submit" and type="image")
Code:-
<form action="demo_form.asp">
First name: <input type="text"
name="fname"><br>
Last name: <input type="text"
name="lname"><br>
<input type="submit" value="Submit"><br>
<input type="submit"
formaction="demo_admin.asp"
value="Submit as admin">
</form>
Output:-
Code:-
<form action="demo_form.asp">
First name: <input type="text"
name="fname"><br>
Last name: <input type="text"
name="lname"><br>
<input type="image" src="img_submit.gif"
alt="Submit" width="48" height="48">
</form>
Output:-
Refers to a <datalist> element that contains pre-defined options for an <input> element
Code:-
<form action="demo_form.asp"
method="get">
<input list="browsers" name="browser">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
<input type="submit">
</form>
Output:-
Specifies that a user can enter more than one value in an <input> element
Code:-
<form action="demo_form.asp">
Select images: <input type="file"
name="img" multiple>
<input type="submit">
</form>
Output:-
Code:-
<form action="demo_form.asp">
Country code: <input type="text"
name="country_code" pattern="[A-Za-z]{3}"
title="Three letter country code">
<input type="submit">
</form>
Output:-
Specifies a short hint that describes the expected value of an <input> element
Code:-
<form action="demo_form.asp">
<input type="text" name="fname"
placeholder="First name"><br>
<input type="text" name="lname"
placeholder="Last name"><br>
<input type="submit" value="Submit">
</form>
Output:-
Specifies that an input field must be filled out before submitting the form
Code:-
<form action="demo_form.asp">
Username: <input type="text"
name="usrname" required>
<input type="submit">
</form>
Output:-
The <keygen> tag specifies a key-pair generator field used for forms.
When the form is submitted, the private key is stored locally, and the public key is sent to the server.
Code:-
<form
oninput="x.value=parseInt(a.value)+parseInt(
b.value)">0
<input type="range" id="a" value="50">100 +
<input type="number" id="b" value="50">=
<output name="x" for="a b"></output>
</form>
Output:-