I'm searching for correct usage of <address>
element.
For example, i have to show more than one address, so i need to write them in an address element or seperate for each other?
<p>BLA BLA CO.</p>
<address>
<span class="full-address">XXX ST. XXX ETC.</span>
<span class="city">IZMIR</span>
<span class="town">Bornova</span>
<span class="phone">+11 111 111 1111</span>
<span class="fax">+11 111 111 1112</span>
</address>
<p>OTHER BLA CO.</p>
<address>
<span class="full-address">XXX ST. XXX ETC.</span>
<span class="city">IZMIR</span>
<span class="town">Bornova</span>
<span class="phone">+11 111 111 1111</span>
<span class="fax">+11 111 111 1112</span>
</address>
What is the correct usage of this?
The <address> HTML element indicates that the enclosed HTML provides contact information for a person or people, or for an organization.
The <address> tag in HTML is used to write contact information of a person or an organization. If <address> tag is used inside the <body> tag then it represents the contact information of the document and if the <address> tag is used inside the <article> tag, then it represents the contact information of the article.
The <html> element is the root element and it defines the whole HTML document. It has a start tag <html> and an end tag </html> .
HTML 5 <address> Tag If the tag applies to the body element, then it applies to the document as a whole. The <address> tag must not be used to represent arbitrary addresses (e.g. postal addresses), unless those addresses are contact information for the section. To display postal addresses, simply use the <p> tag.
In your use-case, it probably is incorrect usage.
As per the official refs:
The address element must not be used to represent arbitrary addresses (e.g. postal addresses), unless those addresses are in fact the relevant contact information. (The p element is the appropriate element for marking up postal addresses in general.)
Ref, Living standard: https://html.spec.whatwg.org/multipage/semantics.html#the-address-element
Ref, Spec HTML4.01: http://www.w3.org/TR/html401/struct/global.html#h-7.5.6
Ref, Recomendation HTML5: http://www.w3.org/TR/html5/sections.html#the-address-element
.
You are presenting several postal addresses, and so it seems a p
is more appropriate here. Regarding address
, it represents contact information for its nearest article
or body
and is also allowed in footer
.
Well, depending on this source the <address>
tag is not an actually address in your usecase. Its more like a pointer to the page author. Means, it should contain your own address.
Additional info by w3schools
The <address>
tag defines the contact information for the author/owner of a document or an article.
If the <address>
element is inside the <body>
element, it represents contact information for the document.
If the <address>
element is inside an <article>
element, it represents contact information for that article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With