Reputation: 16793
For a listing of events, I was planning on using the HTML5 Address in the markup to show search engines this is a location. I will be displaying 5 upcoming events on the homepage.
Do I put this inside a section
or article
?
When I read the HTML5 specification it confuses me, if anybody could explain how to use this better.
Updated with code from Steve:
<ul>
<li>
<h3><a href="<?php echo $event['href']; ?>" title="<?php echo $event['title']; ?>"><?php echo $event['title']; ?></a></h3>
<p><?php echo $event['description']; ?>
<span class="datetime">When: <time datetime="<?php echo $event['start_date']; ?>" pubdate="pubdate"><?php echo date('d-m-Y', strtotime($event['start_date'])); ?></time></span>
<span class="location">Where: <address><?php echo $event['location']; ?></address></span></p>
</li>
Upvotes: 1
Views: 2852
Reputation: 1600
Just to reiterate what tw16 said, you don't want to be using the <address>
if you want to keep your code semantic. The tag is used inside an <article>
to semantically display the author information.
Use <p>
for your address.
Upvotes: 3
Reputation: 29575
I am sorry to say, but in this context you are misusing the <address>
tag. It is meant to provide contact information for the author(s) of the document, not for arbitrary addresses.
The address element represents the contact information for its nearest article or body element ancestor. If that is the body element, then the contact information applies to the document as a whole.
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.)
The spec: http://dev.w3.org/html5/spec/sections.html#the-address-element
A helpful article: http://html5doctor.com/the-address-element/
Upvotes: 11
Reputation: 576
If you're showing multiple items, use a list
<ul>
<li>
<address>address</address>
</li>
</ul>
Upvotes: 2