20 replies [Last post]
maurices5000
Offline
Regular
Last seen: 14 years 46 weeks ago
Joined: 2005-11-03
Posts: 14
Points: 0

For the lines of an address should i use a list or a paragraph or what? Is using a list appropriate?

Adressee Name
Street Address
City, State Zip

I think of list as a list of items but not an address. I just don't want to use nonStandard CSS.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 19 hours 12 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9767
Points: 3849

What should I use for an Address?

A paragraph is fine, using <br> to line feed. The <address> element is for something entirely different. Here's an example of the type thing I commonly use

p.addy {
    margin: 1em 0 1em 2em;
    font-size: 0.8em;
    font-style: normal;
    text-transform: capitalize;
    text-indent: -2em;
    }

p.addy:first-line {
    font-weight: bold;
    font-size: 1.2em;
    }
===========
<p class="addy">douglaston golf club (public)<br />
6320 marathon pkwy<br />
flushing, long island, NY 11362</p>

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

maurices5000
Offline
Regular
Last seen: 14 years 46 weeks ago
Joined: 2005-11-03
Posts: 14
Points: 0

What should I use for an Address?

Thanks for the info!

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 39 weeks 5 days ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

Re: What should I use for an Address?

maurices5000 wrote:
For the lines of an address should i use a list or a paragraph or what? Is using a list appropriate?

Adressee Name
Street Address
City, State Zip

I think of list as a list of items but not an address. I just don't want to use nonStandard CSS.

Er, how about the tag actually designated for the purpose:

<address>
Adressee Name
Street Address
City, State Zip
</address>

See http://www.w3schools.com/tags/tag_address.asp

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

Anonymous
Anonymous's picture
Guru

Re: What should I use for an Address?

Ed Seedhouse wrote:
how about the tag actually designated for the purpose:

<address>
Adressee Name
Street Address
City, State Zip
</address>

See http://www.w3schools.com/tags/tag_address.asp I think I agree.

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 39 weeks 5 days ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

Re: What should I use for an Address?

Triumph wrote:
Ed Seedhouse wrote:
how about the tag actually designated for the purpose:

<address>
Adressee Name
Street Address
City, State  Zip
</address>

See http://www.w3schools.com/tags/tag_address.asp I think I agree.

Thankyou, but I think my "code" above should be corrected:

<address>
Adressee Name<br />
Street Address<br />
City, State  Zip<br />
</address>

<address> is a block element often rendered with an italic font, and as a block element it stands to reason it's intended to contain multiple lines.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 19 hours 12 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9767
Points: 3849

What should I use for an Address?

Um, Ed, you're testing your sig. Sorry, picking on you. Smile

The address element is a limited purpose element. It is not for addresses as we commonly use the term, but rather for contact information about the document's author(Drunk.

I suppose this is a niggling difference, and not worth too many words. There is no substantive difference between it and a p in the DTD. Just be aware that most browsers default to italic for the address element.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

HellsBells
HellsBells's picture
Offline
Leader
Bedford, UK
Last seen: 12 years 21 weeks ago
Bedford, UK
Joined: 2004-04-07
Posts: 851
Points: 0

What should I use for an Address?

You could use a Definition List:

<dl id="address">
<dt>Address</dt>
<dd>123 High Street</dd>
<dt>Telephone</dt>
<dd>01234 567 890</dd>
<dt>E-Mail:</dt>
<dd>[email protected]</dd>
</dl>

My strategy is so simple an idiot could have devised it!

"Also, your CSS (no offence) makes me want to gouge my eyes out with a rusty spoon" - TPH

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 8 years 5 days ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

What should I use for an Address?

I'd argue against using <br /> as it is not properly styleable - try br {display: inline}. That is, at a later point if you wish the address to be all on one line, your only choice is to make the <br /> display: none; which gives a less than satisfactory result.

I reckon using markup that wraps each line in a properly styleable element is better. When there isn't an obvious match of html element to your subject matter the choice of elements is pretty subjective.

This is probably overdone, but it would make styling of different parts of the address possible and could match closely to an xml representation of an address.

<div class="address">
<p class="name">Name</p>
<p class="street">Street Address</p>
<p class="city">City</p>
<p class="zip">Zip/Post Code</p>
</div>

style 1
.address p { display: block; margin: 0; }

style 2
.address p { display: inline; margin: 0; white-space: nowrap;}
.address p:after { content: ', '}
.address p.zip:after { content: ''; }
.address p.name { color: blue; }
.address p.city { font-weight: bold; }

Using a definition list as Hellsbells suggest would give you the added option of identifying the information or not through use of display: none;

Here are some samples (view in a modern browser).

maurices5000
Offline
Regular
Last seen: 14 years 46 weeks ago
Joined: 2005-11-03
Posts: 14
Points: 0

What should I use for an Address?

Thanks guys! So i could go ahead and use a list them?

I just feel a bit awkward doing that.

Thanks!

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 39 weeks 5 days ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

What should I use for an Address?

kk5st wrote:
Um, Ed, you're testing your sig. Sorry, picking on you. Smile

The address element is a limited purpose element. It is not for addresses as we commonly use the term, but rather for contact information about the document's author(Drunk.

I suppose this is a niggling difference, and not worth too many words. There is no substantive difference between it and a p in the DTD. Just be aware that most browsers default to italic for the address element.

Apology not needed, but accepted anyway.

I do think the difference you are making is rather subtle. If was only for author contact info wouldn't it logically belong in the document head like the title element?

On the other hand even if you are right it seems a reasonable extension to me, allowing some search engines to identify it as location information for example, as opposed to a simple p, div, or list, none of which have any special semantic meaning that identifes an address.

As for the criticism of my my use of <br />s in a previous message to yours, I can only say they are, so far as I know, still in the specification and presumably for a reason. But if one needs a styling handle one can always wrap each individual line in a div of course.

But at http://www.w3schools.com/tags/tag_address.asp they give the following as an example:

<address>
Donald Duck<br />
Box 555<br />
Disneyland
</address>

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 39 weeks 5 days ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

What should I use for an Address?

kk5st wrote:
address element is a limited purpose element.

I took a look at the url in your comment. It seems to say that <address> is an inline element, which if so, destroys my argument entirely. However http://www.w3schools.com/tags/tag_address.asp says that

Quote:
"Most browsers will add a line break before and after the address element"
which argues that it is a block element and seems to support my previous argument.

Which is the definitive site?

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 37 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

What should I use for an Address?

Ed I think that that actually reads as element address can contain elements of inline and text not that it is an inline element itself, the definitions describe what can be contained rather than what they are themselves.

As for which site is definitive well that is axiomatic; as far as I'm aware W3schools despite it's name has no actual affiliation to W3.org home of the specs, it is just one of the many sites attempting to provide a quick reference and actually is rather lightweight in it's information at times.

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 19 hours 12 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9767
Points: 3849

What should I use for an Address?

The address element has exactly the same description as the p element, except that the closing p tag is optional in html.

The usage seems archaic, going back to html's beginnings as a markup language for exchanging scientific papers. However, it is likely the best semantic usage. Regular addresses, as we normally use them, have a variety of structures and meanings, so I am comfortable not having a specific element.

I have no problem using br elements as structural markup. Addresses and poetry seem to require them.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 37 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

What should I use for an Address?

There is a use for <br>, it seems at times people take to heart too literally separation of content from presentation. <br> can be thought of as both presentational and structural. It has, as mentioned, it's place in 'address' and 'poetry' and possibly in 'forms' as well.

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 39 weeks 5 days ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

What should I use for an Address?

Hugo wrote:
There is a use for <br>, it seems at times people take to heart too literally separation of content from presentation. <br> can be thought of as both presentational and structural. It has, as mentioned, it's place in 'address' and 'poetry' and possibly in 'forms' as well.

Wait! There's a <poetry> tag? Laughing out loud

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 8 years 5 days ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

What should I use for an Address?

Hugo wrote:
There is a use for <br>, it seems at times people take to heart too literally separation of content from presentation.

Not literally. Maybe its because I am often generating content in PHP and rather than redo the generator its easier to restyle it. Sometimes and address needs to appear on one line, sometimes it needs to appear over several lines, <br /> doesn't support that flexibility.

As I think I mentioned at the top of my post, in decisions like this, there is no right or wrong. Some people will go one way, others another. If you don't need the extra flexibility, use <br />[1], just make your decision in the light of all the facts Wink

I seem to recall somewhere that one of the up and coming specs for HTML or XHTML proposes a <line> element to overcome this issue.

[1] Or prevail on browser manufacturers to support proper styling of <br />. display:inline would be handy. display:before & display:after would also be nice.

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 37 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

What should I use for an Address?

Chris, the comment was a generalization not aimed anywhere specifically Smile

I understand what you're saying completely, there is a propensity though for considering the <br> tag an evil little so and so, which is misguided, I was musing out loud so to speak.

Although wouldn't being able style a line break as display:inline be somewhat of an oxymoron!

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 8 years 5 days ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

What should I use for an Address?

Hugo wrote:
there is a propensity though for considering the <br> tag an evil little so and so, which is misguided

Perhaps not, at least not according to the standards wonks. Look here, you won't find it.

Which means your XHTML2.0 address will look like

<p class="address">
  <l>Hugo Inc.</l>
  <l>345th Floor</l>
  <l>Really Tall Building</l>
  <l>First Avenue</l>
  <l>Metropolis</l>
  <l>M1 1HUG</l>
</p>

Tongue

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 37 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

What should I use for an Address?

Smile Tend not to consider XHTML 2.0, it's a fair point though, however we are getting into the slightly rarified area of XML aren't we?

And the address is actually:

 
<p class="address"> 
  <l>Hugo mega corp Inc.</l> 
  <l>Penthouse Suite</l> 
  <l>Global Mega Corp Tower</l> 
  <l>First Avenue</l> 
  <l>Metropolis</l> 
  <l>M1 1HUG</l> 
</p> 

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 8 years 5 days ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

What should I use for an Address?

and there was me trying to keep your anonymity.