Add Address Tag to Your Webpage
Working with Text
In this lesson, we will learn how to use the address tag in HTML.
What is Address Tag in HTML
The address tag is an HTML tag used to specify the contact information of the author or owner of a webpage. It is typically used in the footer section of a webpage, but it can be used anywhere on the page to provide contact information. It is displayed as italic text on browser.
The syntax for the address tag is straightforward. It requires an opening and closing address tag, and the contact information is placed between these two tags.
Here's an example of how to use <address> tag in HTML:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>Address Tag Example</title> </head> <body> <address> Your Name<br> Your Address<br> City, State Zip<br> Phone: (123) 456-7890<br> Email: yourema[email protected] </address> </body> </html>
Attributes of Address Tag
Here are the attributes we can use with the address tag:
The id attribute is used to assign a unique name to an element on a web page. We can assign an id to the address tag and use it to apply a specific style to that particular tag.
<address id="addr">Email: [email protected]</address>
Note: The id attribute can be used on any tag to assign a unique tag name. It must be unique for each tag, meaning we can't use the same id name for another tag in an HTML document.
The class attribute is used to define a group of elements and to apply a specific style to that group. We can define a class for the address tags and use it to apply a specific style to all the address tags that belong to a particular class.
<address class="info"> 231 GREEN HARBOR RD<br> OLD HICKORY TN 37138-1095<br> USA </address> <address class="info"> 804 TAYLOR ST<br> WASHINGTON DC 20011-5848<br> USA </address>
In the above example, both address tags have the same class name, info. If any CSS style is applied to the class name info, it will be applied on both address tags.
Note: The class attribute can be used on any tag to assign a group name to the tag.
The style attribute can be used to apply inline css styles to the address tag. We will learn how to apply inline css style using the style attribute later in our CSS tutorial.
<address style="color: red"> 231 GREEN HARBOR RD<br> OLD HICKORY TN 37138-1095<br> USA </address>
The style="color: red" will change the font color of the address tag to red.
The align attribute can be used to align an address tag horizontally left, right or center on the webpage.
<address align="right"> 231 GREEN HARBOR RD<br> OLD HICKORY TN 37138-1095<br> USA </address>