HTML 5
HTML 5
HTML 5
What is HTML5?
What is HTML5?
HTML5 is the new standard for HTML.
HTML5 is also cross-platform (it does not care whether you are using
a tablet or a smartphone, a notebook, notebook or a Smart TV).
Differences Between HTML4 and
HTML5
Differences Between HTML4 &
HTML5
1. HTML5 is a work in progress
2. Simplified Syntax
3. The New <canvas> Element for 2D drawings
4. New content-specific elements, like <article>,
<header>, <footer>, <nav>, <section>
5. New <menu> and <figure> Elements
6. New <audio> and <video> Elements
7. New form controls, like calendar, date, time, email,
url, search
8. No More <frame>, <center>, <big>, and <b>, <font>
9. Support for local storage
Browser Support for HTML5
Browser Support for HTML5
HTML5 is not yet an official standard, and no
browsers have full HTML5 support.
<!DOCTYPE html>
Minimum HTML5 Document
Below is a simple HTML5 document, with the minimum of required
tags:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
</head>
<body>
Content of the document......
</body>
</html>
HTML5 New Elements
• New Elements in HTML5
• Semantics is the study of the meanings of
words and phrases in language.
• Semantic elements are elements with a
meaning.
• A semantic element clearly describes its
meaning to both the browser and the
developer.
• Examples of non-semantic elements: <div>
and <span> - Tells nothing about its content.
• Examples of semantic elements: <form>,
<table>, and <img> - Clearly defines its
content.
New Semantic Elements in HTML5
HTML5 offers new semantic elements to define different parts of a web page:
• HTML5 <section> Element
• The <section> element defines a section in a
document.
• "A section is a thematic grouping of content,
typically with a heading."
• A Web site's home page could be split into
sections for introduction, content, and contact
information.
• Example
• <section>
<h1>WWF</h1>
<p>The World Wide Fund for Nature (WWF)
is....</p>
</section>
• HTML5 <article> Element
• The <article> element specifies independent, self-contained
content.
• An article should make sense on its own, and it should be
possible to read it independently from the rest of the web
site.
• Examples of where an <article> element can be used:
• Forum post
• Blog post
• Newspaper article
• Example
• <article>
<h1>What Does WWF Do?</h1>
<p>WWF's mission is to stop the degradation of our
planet's natural environment,
and build a future in which humans live in harmony with
nature.</p>
</article>
• HTML5 <header> Element
• The <header> element specifies a header for a document or
section.
• The <header> element should be used as a container for
introductory content.
• You can have several <header> elements in one document.
• The following example defines a header for an article:
• Example
• <article>
<header>
<h1>What Does WWF Do?</h1>
<p>WWF's mission:</p>
</header>
<p>WWF's mission is to stop the degradation of our
planet's natural environment,
and build a future in which humans live in harmony with
nature.</p>
</article>
• HTML5 <footer> Element
• The <footer> element specifies a footer for a
document or section.
• A <footer> element should contain information about
its containing element.
• A footer typically contains the author of the
document, copyright information, links to terms of
use, contact information, etc.
• You can have several <footer> elements in one
document.
• Example
• <footer>
<p>Posted by: vinayak</p>
<p>Contact
information: <a href="mailto:someone@example.com
">
someone@example.com</a>.</p>
</footer>
• HTML5 <nav> Element
• The <nav> element defines a set of navigation
links.
• The <nav> element is intended for large blocks of
navigation links. However, not all links in a
document should be inside a <nav> element!
• Example
• <nav>
<a href="/html/">HTML</a> |
<a href="/css/">CSS</a> |
<a href="/js/">JavaScript</a> |
<a href="/jquery/">jQuery</a>
</nav>
• HTML5 <aside> Element
• The <aside> element defines some content aside
from the content it is placed in (like a sidebar).
• The aside content should be related to the
surrounding content.
• Example
• <p>My family and I visited The Epcot center this
summer.</p>
<aside>
<h4>Epcot Center</h4>
<p>The Epcot Center is a theme park in Disney
World, Florida.</p>
</aside>
• HTML5 <figure> and <figcaption> Elements
• In books and newspapers, it is common to have captions
with images.
• The purpose of a caption is to add a visual explanation to an
image.
• With HTML5, images and captions can be grouped together
in <figure> elements:
• Example
• <figure>
<img src="pic_mountain.jpg" alt="The Pulpit
Rock" width="304" height="228">
<figcaption>Fig1. - The Pulpit Rock, Norway.</figcaption>
</figure>
• The <img> element defines the image,
the <figcaption> element defines the caption.
Semantic Elements in HTML5