HTML address Tag
Discover how to use the HTML <address> tag to semantically represent contact information for a document or an article.
This information can include names, physical addresses, URLs, email addresses, phone numbers, social media handles, etc.
When an
<address>
tag is used within the <body>
of a document, it represents contact information for the document itself.
When used within an <article>
element, it represents contact information for that specific article.
Basic Syntax
html
<address>
<p>John Doe</p>
<p>Visit us at:<br>Example.com<br>Box 564, Disneyland<br>USA</p>
<p>Email: <a href="mailto:john.doe@example.com">john.doe@example.com</a></p>
</address>
Features
- Semantic Meaning: It clearly indicates that the enclosed content is contact information.- Block-Level Element: By default, it starts on a new line and takes up the full width available.
- Italicization: Most browsers render the content of an
<address>
tag in italics by default. This can be overridden with CSS.
Examples
Contact for the entire document (e.g., in a site footer):html
<footer>
<address>
Contact: <a href="mailto:webmaster@example.com">Webmaster</a><br>
Visit us at: Example Corp, 123 Web St, Internet City
</address>
</footer>
Contact for an article:
html
<article>
<h2>My Awesome Article</h2>
<p>Content of the article...</p>
<footer>
<address>
Posted by: Jane Smith<br>
Contact: <a href="mailto:jane.smith@example.com">jane.smith@example.com</a>
</address>
</footer>
</article>
What Not to Include
The<address>
tag should not be used for arbitrary addresses that are not contact information for the document or article (e.g., a postal address in the middle of a text describing a location).
Benefits
- Improved Semantics: Helps machines (like search engines and assistive technologies) understand the purpose of the content.- Accessibility: Can aid screen readers in identifying and presenting contact details.
- SEO: While not a major ranking factor, clear semantic markup can contribute to better site understanding by search engines. Using the
<address>
tag appropriately enhances the semantic structure of your HTML documents, making your content more accessible and machine-readable.