Quick html help

Soldato
Joined
6 Jan 2006
Posts
3,388
Location
Newcastle upon Tyne
What is the best way to add an address (physical location) in html?

Ive tried using <p> but it puts too big a space inbetween each address line. I think I have seen it used with a break but Im sure I remember someone saying that wasnt the correct method?

THanks
 
You can style <p> with CSS. Using <br> (break) is still valid though if you want to use that, but a styled <p> would be better, in fact I would use <li>.

Styled <p>:
Code:
CSS:
p.address { padding-bottom: 3px; }

HTML:
<p class="address">123 Fake St.</p>
<p class="address">Some place</p>

<br>:
Code:
HTML:
123 Fake St.<br>
Some place
 
I stand corrected. :)

EDIT: *not always the case
Ahhh, I see what you mean. It's not acceptable for any old address, but is acceptable if it is the address of the owner of the document. ie: if the site is for Company Inc., the address for Company Inc. would be fine being put inside an address tag.
 
Last edited:
It's all semantics really but yeah, that's fine Mark.

However, depending on how you see the information being used you might find the hCard Microformat would be better received under some circumstances.

http://html5doctor.com/microformats/#hcard

For example, mobile devices are able to pick the hCard microformat out of your page and easily create a contact. They would not be able to do this if you just used the <address> tag as suggested by Tripnologist.

The chances of someone actually using that functionality though? Well, when was the last time you ever did it? :)
 
Back
Top Bottom