HTML5
HTML5
Introduction
• HTML5 will be the new standard for HTML.
• The previous version of HTML, HTML 4.01, came in 1999. The web has
changed a lot since then
• HTML5 is a cooperation between the World Wide Web Consortium (W3C) and
the Web Hypertext Application Technology Working Group (WHATWG).
• WHATWG was working with web forms and applications, and W3C was
working with XHTML 2.0. In 2006, they decided to cooperate and create a new
version of HTML.
• Some rules for HTML5 were established:
• New features should be based on HTML, CSS, DOM, and JavaScript
• Reduce the need for external plugins (like Flash)
• Better error handling
• More markup to replace scripting
• HTML5 should be device independent
• The development process should be visible to the public
• <!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
The content of the document......
</body>
</html>
• The <!DOCTYPE> declaration must be the very first thing in your HTML
document, before the <html> tag.
• The <!DOCTYPE> declaration is not an HTML tag;
• It is an instruction to the web browser about what version of HTML the page
is written in.
• In HTML 4.01, the <!DOCTYPE> declaration refers to a DTD, because
HTML 4.01 was based on SGML.
• The DTD specifies the rules for the markup language, so that the browsers
render the content correctly.
• HTML5 is not based on SGML, and therefore does not require a reference to
a DTD
• The most interesting new HTML5 elements are:
• New semantic elements like <header>, <footer>, <article>, and
<section>.
• New attributes of form elements like number, date, time, calendar, and
range.
• New graphic elements: <svg> and <canvas>.
• New multimedia elements: <audio> and <video> for media playback
• <canvas> element for 2D drawing
• Support for local storage
• New APIS :
• HTML Geolocation
• HTML Drag and Drop
• HTML Local Storage
• HTML Application Cache
• HTML Web Workers
• HTML SSE
Following tags are removed from previous version
• <acronym>
• <applet>
• <basefont>
• <big>
• <center>
• <dir>
• <font>
• <frame>
• <frameset>
• <noframes>
• <strike>
• <tt>
Common Attributes
• accesskey Specifies a shortcut key to activate/focus an element
• class Specifies one or more classnames for an element (refers to a class in a
style sheet)
• contentEditable Specifies whether the content of an element is editable or not
• Contextmenu Specifies a context menu for an element. The context menu appears
when a user right-clicks on the element
• dir Specifies the text direction for the content in an element
• draggable Specifies whether an element is draggable or not
• dropZone Specifies whether the dragged data is copied, moved, or linked, when
dropped
• hidden Specifies that an element is not yet, or is no longer, relevant
• id Specifies a unique id for an element
• langSpecifies the language of the element's content
• spellCheck Specifies whether the element is to have its spelling and grammar
checked or not
• Style Specifies an inline CSS style for an element
• tabindexSpecifies the tabbing order of an element
• title Specifies extra information about an element
• Tag Description
• <article> Defines an article
• <aside> Defines content aside from the page content
• <audio> Defines sound content
• <bdi> Isolates a part of text that might be formatted in a different
direction from other text outside it
• <canvas> Used to draw graphics, on the fly, via scripting (usually
JavaScript)
• <command> Defines a command button that a user can invoke
• <datalist> Specifies a list of pre-defined options for input controls
• <details> Defines additional details that the user can view or hide
• <embed> Defines a container for an external (non-HTML) application
• <figcaption> Defines a caption for a <figure> element
• <figure> Specifies self-contained content
• <footer> Defines a footer for a document or section
• <header> Defines a header for a document or section
Differences between HTML 4.0 and 5
• In body tag , all layout attributes are removed.
(alink,background,text,bgcolor,link,vlink)
• Form : HTML5 has added two new attributes: autocomplete and novalidate,
and removed the accept attribute.
• Img : align, border, hspace, longdesc, and vspace is not supported in HTML5.
• Meta : HTML5 has a new attribute, charset, <meta charset="UTF-8">
• Table : HTML5 only supports the "border" attribute, and its value can be "1" or
"".
• Div : The align attribute not supported in HTML5.
• A- In HTML 4.01, the <a> tag could be either a hyperlink or an anchor. In
HTML5, the <a> tag is always a hyperlink, but if it has no href attribute, it is
only a placeholder for a hyperlink.