If you find this helpful, please click the Google Button to the left, if it is white, to make it turn blue or red. Thank you! (It also helps find this page again more easily.) |
The <address> Tag in HTML 5
The address tag is used for contact information for the current article, if it is coded inside an article element, or else the document as a whole if not.
The address can be a simple mailto:
link:
<address> <a href="mailto:John Doe <John.Doe@ExampleOnly.com>">Contact the author</a> </address>
Or, the address can be a hypertext link to a user profile with contact information:
<address> <a href="/users/John.Doe/">View John Doe's profile and contact info</a> </address>
The <address> tag is only to be used for contact information. A postal mailing address should only be put inside an address element if the method for contacting the author(s) is via postal mail.
<address> Tag Syntax
Rules for coding HTML address
elements
<body> ... ... flow content expected ... <address> ... flow content ... </address> ... </body>
- Inside an element where flow content is allowed, code one or more optional address elements.
- Begin each address element with a starting <address> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the
xmlns
attribute on the <html> tag. - Include any HTML global attributes on the <address> tag as appropriate.
- End the address element with a matching
</address>
closing tag. - Inside the address element, include any allowable flow content as appropriate.
<address> Content Model
Content of the <address> Tag
The content of the address element can include HTML comments, text content and any tags that can be used in flow content except for <header>
tags, <hgroup>
tags, <hn>
heading tags, <footer>
tags, <article>
tags, <aside>
tags, <nav>
tags, <section>
tags or other <address>
tags, which are not permitted anywhere under the address element.
<address> Tag Attributes
Attributes of the <address> tag
global attributes | The only attributes that can be coded on the <address> tag are the common HTML attributes. |
<address> Tag Examples
Examples of the address
tag in HTML 5
<address> tag with a hypertext link
<address> <a href="/users/John.Doe/">View John Doe's profile</a> </address>
<address> tag with a mailto:
link
<body> <p>By <address> <a href="mailto:John.Doe@ExampleOnly.com">John Doe (contact the author)</a> </address></p> ... </body> <article> <h2>April Fools!<h2> <p>Published: Friday, April 1, 2011<br/> By: <address> <a href="mailto:John Doe <John.Doe@ExampleOnly.com>">John Doe (contact the author)</a> </address> </p> <p>Today's blog entry is an April Fool's Day joke....</p> </article>
The value of the <a href> attribute starts with the mailto
scheme followed by a semicolon (:
). The "To" address follows it and can be coded as:
- the e-mail address
- a display name, which may include special characters if enclosed in quotes (
"
), which must be encoded as"
in an attribute value, and the e-mail address enclosed in angle brackets (<...>
), which must be encoded with the HTML character entities<
and>
.
Changes in HTML 5 - <address> Tag
What's new in HTML 5
Differences between HTML 5 and earlier versions of HTML
The 2000-2010 Recommendations from the W3C HTML Working Group defined the HTML namespace for the address element type name along with the names of all HTML element types. In older (pre-2000) versions of HTML, element type names were not associated with a namespace.