HTML address Tag
HTML (Hypertext Markup Language) is the standard markup language for creating web pages and web applications. Within HTML, various tags are used to define different parts of a web page’s content. One such tag is the <address>
tag, which plays a specific role in presenting contact and authorship information.
What is the <address>
Tag?
The <address>
tag in HTML is used to define the contact information of the author or owner of a document or an article. This tag is intended to contain information such as the author’s name, email address, phone number, or physical address. The content inside the <address>
tag typically displays in italicized form by default, indicating that the text is different from the main content.
Usage of the <address>
Tag
The primary use of the <address>
tag is to provide a semantic way to present contact information on web pages. This tag is not intended for generic addresses or non-contact information. Here are some key points regarding its usage:
- Semantic Meaning: The
<address>
tag gives the enclosed information a semantic meaning as contact details, which is beneficial for search engines and screen readers. - Styling: By default, browsers usually style the content of the
<address>
tag in italics. However, this can be overridden with CSS. - Not for Arbitrary Addresses: It’s important to note that this tag is not meant for all types of addresses (like postal addresses in a shipping form). It’s specifically for contact information related to the author or owner of a document.
Example of the <address>
Tag in Use
Here’s a simple example of how the <address>
tag can be used in an HTML document:
<!DOCTYPE html>
<html>
<head>
<title>Sample HTML Page with Address Tag</title>
</head>
<body>
<article>
<h2>Blog Post Title</h2>
<p>This is an example of a blog post. It discusses various topics and presents interesting facts.</p>
<footer>
<address>
Written by <a href="mailto:john.doe@example.com">John Doe</a>.<br>
Visit us at:<br>
Example.com<br>
Box 564, Disneyland<br>
USA
</address>
</footer>
</article>
</body>
</html>
In this example, the <address>
tag is used within the <footer>
of an article to provide the author’s contact information, including an email address and a physical address. The use of <br>
tags is for line breaks, and the email address is made clickable using the <a>
tag with the mailto:
protocol.
Conclusion
The <address>
tag is a useful semantic element in HTML that helps in correctly defining contact information related to a document or an article. It ensures that this information is presented and interpreted correctly by browsers and assistive technologies, contributing to better accessibility and SEO. By using the <address>
tag appropriately, web developers can enhance the semantic structure and clarity of their web pages.
Tag:html tags