How to markup postal address in HTML?


Addresses are used in physically locating a building. An address is a information, presented in a fixed format, used to give the location of a building, apartment, along with other identifiers are used such as house or apartment numbers.

We use <address> tag, to provide contact details on the web page. The HTML <address> tag defines the contact information for the author of a document or an article on the web page.

The contact information can be a building location, email address, URL, phone number, etc. The text in the <address> element usually renders in italic format, and it will always add a line break before and after the <address> element.

Syntax

Following is the syntax for the <address> tag.

<address>The contact information</address>

Example

Following is the example program for the <address> tag.

<!DOCTYPE html> <html> <head> <title>HTML address tag</title> </head> <body> <address> USA </address> </body> </html>

Example

Following is another example program for the <address> tag.

<!DOCTYPE html> <html> <body> <p>The address of DLF building, Hyderabad</p> <address> Cybercity Plot.No: 129,130,132<br> Gachibowli Rd,<br> Colony:APHB Colony,<br> City:Hyderabad,<br> State:Telangana, <br> Pincode:500019<br> </address> </body> </html>

Example

In this we changed the default style od <address> tag by using CSS.

<!DOCTYPE html> <html> <head> <title>HTML address tag</title> <style> address { display: block; font-family: "Lucida Console", "Courier New", monospace; }; </style> </head> <body> <h1>Contact us</h1> <address> 52nd Street<br> New York,<br> NY 10019<br> USA </address> </body> </html>

Updated on: 11-Nov-2022

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements