Wednesday, August 15, 2012

HTML5 Tag Reference


HTML5

HTML5 improves interoperability and reduces development costs by making precise rules on how to handle all HTML elements, and how to recover from errors.

Some of the new features in HTML5 are functions for embedding audio, video, graphics, client-side data storage, and interactive documents. HTML5 also contains new elements like <nav>, <header>, <footer>, and <figure>.

The HTML5 working group includes AOL, Apple, Google, IBM, Microsoft, Mozilla, Nokia, Opera, and many hundreds of other vendors.

Note: HTML5 is not a W3C recommendation yet!
To read about the HTML5 activities at W3C, please read our W3C tutorial.

Ordered Alphabetically

New : New tags in HTML5.

TagDescription
<!--...-->Defines a comment
<!DOCTYPE> Defines the document type
<a>Defines a hyperlink
<abbr>Defines an abbreviation
<acronym>Not supported in HTML5
<address>Defines contact information for the author/owner of a document/article
<applet>Not supported in HTML5
<area>Defines an area inside an image-map
<article>NewDefines an article
<aside>NewDefines content aside from the page content
<audio>NewDefines sound content
<b>Defines bold text
<base>Specifies the base URL/target for all relative URLs in a document
<basefont>Not supported in HTML5
<bdi>NewIsolates a part of text that might be formatted in a different direction from other text outside it
<bdo>Overrides the current text direction
<big>Not supported in HTML5
<blockquote>Defines a section that is quoted from another source
<body>Defines the document's body
<br>Defines a single line break
<button>Defines a clickable button
<canvas>NewUsed to draw graphics, on the fly, via scripting (usually JavaScript)
<caption>Defines a table caption
<center>Not supported in HTML5
<cite>Defines the title of a work
<code>Defines a piece of computer code
<col>Specifies column properties for each column within a <colgroup> element 
<colgroup>Specifies a group of one or more columns in a table for formatting
<command>NewDefines a command button that a user can invoke
<datalist>NewSpecifies a list of pre-defined options for input controls
<dd>Defines a description of an item in a definition list
<del>Defines a text that has been deleted from a document
<details>NewDefines additional details that the user can view or hide
<dfn>Defines a definition term
<dir>Not supported in HTML5
<div>Defines a section in a document
<dl>Defines a definition list
<dt>Defines a term (an item) in a definition list
<em>Defines emphasized text 
<embed>NewDefines a container for an external (non-HTML) application.
 
<fieldset>Groups related elements in a form
<figcaption>NewDefines a caption for a <figure> element
<figure>NewSpecifies self-contained content
<font>Not supported in HTML5
<footer>NewDefines a footer for a document or section
<form>Defines an HTML form for user input
<frame>Not supported in HTML5
<frameset>Not supported in HTML5
<h1> to <h6>Defines HTML headings
<head>Defines information about the document
<header>NewDefines a header for a document or section
<hgroup>NewGroups heading (<h1> to <h6>) elements
<hr>Defines a thematic change in the content
<html>Defines the root of an HTML document
<i>Defines a part of text in an alternate voice or mood
<iframe>Defines an inline frame
<img>Defines an image
<input>Defines an input control
<ins>Defines a text that has been inserted into a document
<keygen>NewDefines a key-pair generator field (for forms)
<kbd>Defines keyboard input
<label>Defines a label for an input element
<legend>Defines a caption for a <fieldset>, <figure>, or <details> element
<li>Defines a list item
<link>Defines the relationship between a document and an external resource (most used to link to style sheets)
<map>Defines a client-side image-map 
<mark>NewDefines marked/highlighted text
<menu>Defines a list/menu of commands
<meta>Defines metadata about an HTML document
<meter>NewDefines a scalar measurement within a known range (a gauge)
<nav>NewDefines navigation links
<noframes>Not supported in HTML5
<noscript>Defines an alternate content for users that do not support client-side scripts
<object>Defines an embedded object
<ol>Defines an ordered list
<optgroup>Defines a group of related options in a drop-down list
<option>Defines an option in a drop-down list
<output>NewDefines the result of a calculation
<p>Defines a paragraph
<param>Defines a parameter for an object
<pre>Defines preformatted text
<progress>NewRepresents the progress of a task
<q>Defines a short quotation
<rp>NewDefines what to show in browsers that do not support ruby annotations
<rt>NewDefines an explanation/pronunciation of characters (for East Asian typography)
<ruby>NewDefines a ruby annotation (for East Asian typography)
<s>Defines text that is no longer correct
<samp>Defines sample output from a computer program
<script>Defines a client-side script
<section>NewDefines a section in a document
<select>Defines a drop-down list
<small>Defines smaller text
<source>NewDefines multiple media resources for media elements (<video> and <audio>)
<span>Defines a section in a document
<strike>Not supported in HTML5
<strong>Defines important text
<style>Defines style information for a document
<sub>Defines subscripted text
<summary>NewDefines a visible heading for a <details> element
<sup>Defines superscripted text
<table>Defines a table
<tbody>Groups the body content in a table
<td>Defines a cell in a table
<textarea>Defines a multiline input control (text area)
<tfoot>Groups the footer content in a table
<th>Defines a header cell in a table
<thead>Groups the header content in a table
<time>NewDefines a date/time
<title>Defines a title for the document
<tr>Defines a row in a table
<track>NewDefines text tracks for media elements (<video> and <audio>)
<tt>Not supported in HTML5
<u>Defines text that should be stylistically different from normal text
<ul>Defines an unordered list
<var>Defines a variable
<video>NewDefines a video or movie
<wbr>NewDefines a possible line-break

HTML5 Tutorial


HTML5 is The New HTML Standard

HTML5

  • New Elements
  • New Attributes
  • Full CSS3 Support
  • Video and Audio
  • 2D/3D Graphics
  • Local Storage
  • Local SQL Database
  • Web Applications

Examples in Each Chapter


With our HTML editor, you can edit the HTML, and click on a button to view the result.

Example

<!DOCTYPE HTML>
<html>
<body>

<video width="320" height="240" controls="controls">
  <source src="movie.mp4" type="video/mp4" />
  <source src="movie.ogg" type="video/ogg" />
  <source src="movie.webm" type="video/webm" />
Your browser does not support the video tag.
</video>

</body>
</html>

Try it yourself »

Click on the "Try it yourself" button to see how it works

HTML5 References


At W3Schools you will find complete references about tags, global attributes, standard events, and more.

HTTP Status Messages


When a browser requests a service from a web server, an error might occur.
This is a list of HTTP status messages that might be returned:

1xx: Information

Message:Description:
100 ContinueThe server has received the request headers, and the client should proceed to send the request body
101 Switching ProtocolsThe requester has asked the server to switch protocols
103 CheckpointUsed in the resumable requests proposal to resume aborted PUT or POST requests

2xx: Successful

Message:Description:
200 OKThe request is OK (this is the standard response for successful HTTP requests)
201 CreatedThe request has been fulfilled, and a new resource is created 
202 AcceptedThe request has been accepted for processing, but the processing has not been completed
203 Non-Authoritative InformationThe request has been successfully processed, but is returning information that may be from another source
204 No ContentThe request has been successfully processed, but is not returning any content
205 Reset ContentThe request has been successfully processed, but is not returning any content, and requires that the requester reset the document view
206 Partial ContentThe server is delivering only part of the resource due to a range header sent by the client

3xx: Redirection

Message:Description:
300 Multiple ChoicesA link list. The user can select a link and go to that location. Maximum five addresses  
301 Moved PermanentlyThe requested page has moved to a new URL 
302 FoundThe requested page has moved temporarily to a new URL 
303 See OtherThe requested page can be found under a different URL
304 Not ModifiedIndicates the requested page has not been modified since last requested
306 Switch ProxyNo longer used
307 Temporary RedirectThe requested page has moved temporarily to a new URL
308 Resume IncompleteUsed in the resumable requests proposal to resume aborted PUT or POST requests

4xx: Client Error

Message:Description:
400 Bad RequestThe request cannot be fulfilled due to bad syntax
401 UnauthorizedThe request was a legal request, but the server is refusing to respond to it. For use when authentication is possible but has failed or not yet been provided
402 Payment RequiredReserved for future use
403 ForbiddenThe request was a legal request, but the server is refusing to respond to it
404 Not FoundThe requested page could not be found but may be available again in the future
405 Method Not AllowedA request was made of a page using a request method not supported by that page
406 Not AcceptableThe server can only generate a response that is not accepted by the client
407 Proxy Authentication RequiredThe client must first authenticate itself with the proxy
408 Request TimeoutThe server timed out waiting for the request
409 ConflictThe request could not be completed because of a conflict in the request
410 GoneThe requested page is no longer available
411 Length RequiredThe "Content-Length" is not defined. The server will not accept the request without it 
412 Precondition FailedThe precondition given in the request evaluated to false by the server
413 Request Entity Too LargeThe server will not accept the request, because the request entity is too large
414 Request-URI Too LongThe server will not accept the request, because the URL is too long. Occurs when you convert a POST request to a GET request with a long query information 
415 Unsupported Media TypeThe server will not accept the request, because the media type is not supported 
416 Requested Range Not SatisfiableThe client has asked for a portion of the file, but the server cannot supply that portion
417 Expectation FailedThe server cannot meet the requirements of the Expect request-header field

5xx: Server Error

Message:Description:
500 Internal Server ErrorA generic error message, given when no more specific message is suitable
501 Not ImplementedThe server either does not recognize the request method, or it lacks the ability to fulfill the request
502 Bad GatewayThe server was acting as a gateway or proxy and received an invalid response from the upstream server
503 Service UnavailableThe server is currently unavailable (overloaded or down)
504 Gateway TimeoutThe server was acting as a gateway or proxy and did not receive a timely response from the upstream server
505 HTTP Version Not SupportedThe server does not support the HTTP protocol version used in the request
511 Network Authentication RequiredThe client needs to authenticate to gain network access

HTML Character Sets



To display an HTML page correctly, the browser must know what character-set to use.

The character-set for the early world wide web was ASCII. ASCII supports the numbers from 0-9, the uppercase and lowercase English alphabet, and some special characters.

Since many countries use characters which are not a part of ASCII, the default character-set for modern browsers is ISO-8859-1.

If a web page uses a different character-set than ISO-8859-1, it should be specified in the <meta> tag.

ISO Character Sets

It is the International Standards Organization (ISO) that defines the standard character-sets for different alphabets/languages.

The different character-sets being used around the world are listed below:

Character setDescriptionCovers
ISO-8859-1Latin alphabet part 1North America, Western Europe, Latin America, the Caribbean, Canada, Africa
ISO-8859-2Latin alphabet part 2Eastern Europe
ISO-8859-3Latin alphabet part 3SE Europe, Esperanto, miscellaneous others
ISO-8859-4Latin alphabet part 4Scandinavia/Baltics (and others not in ISO-8859-1)
ISO-8859-5Latin/Cyrillic part 5The languages that are using a Cyrillic alphabet such as Bulgarian, Belarusian, Russian and Macedonian
ISO-8859-6Latin/Arabic part 6The languages that are using the Arabic alphabet
ISO-8859-7Latin/Greek part 7The modern Greek language as well as mathematical symbols derived from the Greek
ISO-8859-8Latin/Hebrew part 8The languages that are using the Hebrew alphabet
ISO-8859-9Latin 5 part 9The Turkish language. Same as ISO-8859-1 except Turkish characters replace Icelandic ones
ISO-8859-10Latin 6 Lappish, Nordic, EskimoThe Nordic languages
ISO-8859-15Latin 9 (aka Latin 0)Similar to ISO 8859-1 but replaces some less common symbols with the euro sign and some other missing characters
ISO-2022-JPLatin/Japanese part 1The Japanese language
ISO-2022-JP-2Latin/Japanese part 2The Japanese language
ISO-2022-KRLatin/Korean part 1The Korean language


The Unicode Standard

Because the character-sets listed above are limited in size, and are not compatible in multilingual environments, the Unicode Consortium developed the Unicode Standard.

The Unicode Standard covers all the characters, punctuations, and symbols in the world.

Unicode enables processing, storage and interchange of text data no matter what the platform, no matter what the program, no matter what the language.

The Unicode Consortium

The Unicode Consortium develops the Unicode Standard. Their goal is to replace the existing character-sets with its standard Unicode Transformation Format (UTF).

The Unicode Standard has become a success and is implemented in XML, Java, ECMAScript (JavaScript), LDAP, CORBA 3.0, WML, etc. The Unicode standard is also supported in many operating systems and all modern browsers.

The Unicode Consortium cooperates with the leading standards development organizations, like ISO, W3C, and ECMA.

Unicode can be implemented by different character-sets. The most commonly used encodings are UTF-8 and UTF-16:

Character-setDescription
UTF-8A character in UTF8 can be from 1 to 4 bytes long. UTF-8 can represent any character in the Unicode standard. UTF-8 is backwards compatible with ASCII. UTF-8 is the preferred encoding for e-mail and web pages
UTF-1616-bit Unicode Transformation Format is a variable-length character encoding for Unicode, capable of encoding the entire Unicode repertoire. UTF-16 is used in major operating systems and environments, like Microsoft Windows 2000/XP/2003/Vista/CE and the Java and .NET byte code environments

Tip: The first 256 characters of Unicode character-sets correspond to the 256 characters of ISO-8859-1.

Tip: All HTML 4 processors already support UTF-8, and all XHTML and XML processors support UTF-8 and UTF-16!