Professional Documents
Culture Documents
chapter-V-HTML-5-and-Features_220110_171047
chapter-V-HTML-5-and-Features_220110_171047
HTML5 is the latest and most enhanced version of HTML. Technically, HTML is not a
programming language, but rather a markup language.
It is used to design web pages using markup language. HTML is the combination of
Hypertext and Markup language. Hypertext defines the link between the web pages.
Markup language is used to define the text document within tag which defines the
structure of web pages. HTML 5 is the fifth and current version of HTML. It has improved
the markup available for documents and has introduced application programming
interfaces(API) and Document Object Model (DOM).
Features of HTML 5
HTML 5 has introduced new multimedia features which supports audio and video
controls by using <audio> and <video> tags.
In HTML 5 user can grab an object and drag it further dropping it on a new location.
It has Geo Location Service.
It has Web storage facility which provides web application methods to store data
on web browser.
It uses SQL database to store data offline.
It allows to draw various shapes like triangle, rectangle, circle, etc.
HTML 5 is capable of handling incorrect syntax.
In HTML 5 there are new graphics elements including vector graphics and tags.
Enrich semantic content by including <header> <footer>, <article>, <section> and
<figure> are added.
5.2 HTML 5 New elements
<article> tag is used to represent an article. More specifically, the content within
the <article> tag is independent from the other content of the site (even though it
can be related).
<aside> tag is used to describe the main object of the web page in a shorter way
like a highlighter. It basically identifies the content that is related to the primary
content of the web page but does not constitute the main intent of the primary page.
The <aside> tag contains mainly author information, links, related content and so
on.
<figurecaption> tag in HTML is used to set a caption to the figure element in a
document.
<figure> tag in HTML is used to add self-contained content like illustrations,
diagrams, photos or codes listing in a document. It is related to main flow but it can
be used in any position of a document and the figure goes with the flow of the
document and if remove it then it should not affect the flow of the document.
<header> tag contains the section heading as well as other content, such as a
navigation links, table of contents, etc.
<footer> tag in HTML is used to define a footer of HTML document. This section
contains the footer information (author information, copyright information, carriers
etc). The footer tag is used within body tag. The <footer> tag is new in the HTML
5. The footer elements require a start tag as well as an end tag.
<main > delineates the main content of the body of a document or web app.
<mark> tag in HTML is used to define the marked text. It is used to highlight the
part of the text in the paragraph.
<nav> tag is used to declaring the navigational section in HTML documents.
Websites typically have sections dedicated to navigational links, which enables
user to navigate the site. These links can be placed inside a nav tag.
<section> demarcates a thematic grouping of content.
<details> tag is used for the content/information which is initially hidden but could
be displayed if the user wishes to see it. This tag is used to create interactive widget
which user can open or close it. The content of details tag is visible when open the
set attributes.
<summary> tag in HTML is used to define a summary for the <details> element.
<time> tag is used to display the human-readable data/time.
<svg> is the Scalable Vector Graphics.
5.3 Semantics
Elements such as <header>, <footer> and <article> are all considered semantic because
they accurately describe the purpose of the element and the type of content that is inside
them.
Examples:
<header></header>
<section>
<article>
<figure>
<img>
<figcaption></figcaption>
</figure>
</article>
</section>
<footer></footer>
In HTML5 we can draw graphics using HTML elements instead of depending on images
or third-party components like Flash. There are three types of HTML 5 Graphics Canvas,
SVG and Google Maps.
Canvas
Output:
SVG
SVG stands for Scalable Vector Graphics and used to define graphics for the web
The svg element is a container that defines a new coordinate system and viewport. It is used
as the outermost element of SVG documents, but it can also be used to embed an SVG
fragment inside an SVG or HTML document.
Examples 1:
Google Maps
Examples:
<script>
function myMap() {
var mapProp= {
center:new google.maps.LatLng(27.2046,77.4977),
zoom:5,
};
var map = new google.maps.Map(document.getElementById
("googleMap"),mapProp);
}
</script>
<script src="https://maps.googleapis.com/maps/api/js
? key=YOUR_KEY&callback=myMap">
</script>
</body>
</html>
Output:
The media elements, as the HTML5 audio and video elements are generically termed, are
a way of embedding playable media files directly into a web page without having to use
Flash or a plug-in.
Audio
HTML5 supports <audio> tag which is used to embed sound content in an HTML.
MP3 is the best format for compressed recorded music. The term MP3 has become
synonymous with digital music.
Example:
Output:
Video
There are many video formats out there. The current HTML5 draft specification
does not specify which video formats browsers should support in the video tag. But
most commonly used video formats are (ogg and mpeg4).
We can use <source> tag to specify media along with media type and many other
attributes. A video element allows multiple source elements and browser will use
the first recognized format.
Different file format:
MPEG. Developed by the Moving Pictures Expert Group. The first popular
video format on the web. Not supported anymore in HTML.(.mpg, .mpeg)
AVI (Audio Video Interleave). Developed by Microsoft. Commonly used in
video cameras and TV hardware. Plays well on Windows computers, but not
in web browsers.(.avi)
WMV (Windows Media Video). Developed by Microsoft. Commonly used
in video cameras and TV hardware. Plays well on Windows computers, but
not in web browsers. (.wmv)
QuickTime. Developed by Apple. Commonly used in video cameras and TV
hardware. Plays well on Apple computers, but not in web browsers.(.mov)
RealVideo. Developed by Real Media to allow video streaming with low
bandwidths. Does not play in web browsers. (.rm , .ram)
Theora Ogg. Developed by the Xiph.Org Foundation. Supported by
HTML.(.ogg)
WebM. Developed by Mozilla, Opera, Adobe, and Google. Supported by
HTML.(.webm)
MP4. Developed by the Moving Pictures Expert Group. Commonly used in
video cameras and TV hardware. Supported by all browsers
and recommended by YouTube. (.mp4)
Example:
<html>
<head>
<title> Video Demo </title>
</head>
<body>
<p> Kutuma Kutu Song </p>
<video width = "300" height = "200" controls autoplay>
<source src = "kutu.webm" />
Your browser does not support the <video> element.
</video>
</body>
</html>
Output: