Which is the proper way?

P

paul j

I've heard it said that one should avoid excessive "<br />"'s

So if I have a list of things what is the proper way to code it:

<p class="list">Item A</p>
<p class="list">Item B</p>
<p class="list">Item C</p>

OR:

<p class="list">Item A<br />
Item B<br />
Item C<br /></p>
 
B

Beauregard T. Shagnasty

paul said:
I've heard it said that one should avoid excessive "<br />"'s

True enough.
So if I have a list of things what is the proper way to code it:

<p class="list">Item A</p>
<p class="list">Item B</p>
<p class="list">Item C</p>

OR:

<p class="list">Item A<br />
Item B<br />
Item C<br /></p>

You did say "list".

<ul>
<li>Item A</li>
<li>Item B</li>
<li>Item C</li>
</ul>
 
S

Steve Pugh

I've heard it said that one should avoid excessive "<br />"'s

So if I have a list of things what is the proper way to code it:

<p class="list">Item A</p>
<p class="list">Item B</p>
<p class="list">Item C</p>

OR:

<p class="list">Item A<br />
Item B<br />
Item C<br /></p>

Neither. If it is a list as your class name suggests then the correct
markup must be list markup.

<ul>
<li>Item A</li>
<li>Item B</li>
<li>Item C</li>
</ul>

Then use CSS if you want to remove the list markers.

Steve
 
P

paul j

Neither. If it is a list as your class name suggests then the correct
markup must be list markup.

<ul>
<li>Item A</li>
<li>Item B</li>
<li>Item C</li>
</ul>

Then use CSS if you want to remove the list markers.

Steve

I put the word list there, I guess I shouldn't have. What I really have
there is a class that I use to describe the font used.
 
S

Steve Pugh

I put the word list there, I guess I shouldn't have. What I really have
there is a class that I use to describe the font used.

Class names tend to be more useful if they describe what the element
is rather than how it's styled. After all one of the benefits of CSS
is the ease in which the styling can be changed - and it makes no
sense to wither (a) change all the class values to match the new
styling or (b) keep the old class name which is no longer accurate.

Anyway, is your content naturally one paragraph on many paragraphs?
Answer that and you know which is the correct markup. Unless you show
us the actual content we can't tell you.

Steve
 
K

Kris

<xsj68b3bld86.dlg@P7Ax8zefAz8re8ranuGa9rebruMUdruPHeYaPrabru9haSE5r56reT
hufrufRu4p.org>,
paul j said:
Let's say I don't want it in an ordered or unordered list.

Then use CSS to make the bullet/number dissapear.

ul, li {
margin-left: 0; padding-left: 0; list-style-type: none;
}

Whatever you want to make it look like, if it is a list, then it is a
list.
 
U

Uncle Pirate

paul said:
Let's say I don't want it in an ordered or unordered list.

You mean it's not a list? If it is a list, why would you not want to
code it as a list? If it's just those pesky numbers or dots next to it,
they are easily removed using CSS.

--
Stan McCann "Uncle Pirate" http://stanmccann.us/pirate.html
Webmaster/Computer Center Manager, NMSU at Alamogordo
Cooordinator, Tularosa Basin Chapter, ABATE of NM; AMA#758681; COBB
'94 1500 Vulcan (now wrecked) :( http://motorcyclefun.org/Dcp_2068c.jpg
A zest for living must include a willingness to die. - R.A. Heinlein
 
N

Neal

As suggested, use list markup for lists.
I put the word list there, I guess I shouldn't have. What I really have
there is a class that I use to describe the font used.

Class and ID names should describe the content, not the style. Now if the
purpose of the item is to demonstrate a font, then I suppose the name of
the font would be appropriate.

But this leads to a new problem - what if the font is not on the user's
computer? If the user does not have the font installed which you are
referring to, you're sunk. The browser's default font will be used
instead. In this case an image of the text may be necessary.

For more discussion of the font issue and a great example of how to handle
discussion of fonts when the user may not have the font installed, see
<http://www.xs4all.nl/~sbpoley/webmatters/verdana.html>.
 
N

Neal

paul said:
Let's say I don't want it in an ordered or unordered list.

There are two points here.

1) In HTML without considering CSS, we don't even concern ourselves with
rendering. That's inconsequential. If it's a list, it falls into one of
three categories: a list which is inherently ordered <ol>, a list with no
inherent order <ul>, and a list containing terms and definitions <dl>.

Pick which one most closely describes your content. Ingredients to a cake
are not inherently ordered, so we'd use <ul>. The reipe instructions,
however, are inherently ordered, so <ol> is correct. And if you need to
define a list of terms used in the recipe, <dl> can come in handy.

2) Using CSS we can style this list to look like damn near anything at
all. We can remove any bullets or numbering, we can add a custom bulet, we
can make it go left-to-right rather than top-to-bottom. We can even
display it to read like a paragraph in many more-compliant-than-IE
browsers.
 
P

paul j

Class names tend to be more useful if they describe what the element
is rather than how it's styled. After all one of the benefits of CSS
is the ease in which the styling can be changed - and it makes no
sense to wither (a) change all the class values to match the new
styling or (b) keep the old class name which is no longer accurate.

Anyway, is your content naturally one paragraph on many paragraphs?
Answer that and you know which is the correct markup. Unless you show
us the actual content we can't tell you.

Steve

What I'm dealing with is a list of links down a left side column.

I was using:

<p class="linkfont">
<a href="http://www.google.com">Google</a><br />
<a href="http://www.espn.com">ESPN</a><br />
<a href="http://www.yahoo.com">Yahoo</a>
</p>

You're suggesting:

<ul class="linkfont">
<li><a href="http://www.google.com">Google</a></li>
<li><a href="http://www.espn.com">ESPN</a></li>
<li><a href="http://www.yahoo.com">Yahoo</a></li>
</ul>

And then add another css definition for how I like <UL>s to appear? Or can
I include the font style in the definition for the unordered list?
 
S

Steve Pugh

What I'm dealing with is a list of links down a left side column.

So it is a list now? Make your mind up.
I was using:

<p class="linkfont">
<a href="http://www.google.com">Google</a><br />
<a href="http://www.espn.com">ESPN</a><br />
<a href="http://www.yahoo.com">Yahoo</a>
</p>

You're suggesting:

<ul class="linkfont">
<li><a href="http://www.google.com">Google</a></li>
<li><a href="http://www.espn.com">ESPN</a></li>
<li><a href="http://www.yahoo.com">Yahoo</a></li>
</ul>
Yep.

And then add another css definition for how I like <UL>s to appear?
Or can I include the font style in the definition for the unordered list?

Of course you can. There's no limits on the number of properties that
can b defined together.

Steve
 
B

Beauregard T. Shagnasty

paul said:
What I'm dealing with is a list of links down a left side column.

Aha. So it *is* a list.
I was using:

<p class="linkfont">
<a href="http://www.google.com">Google</a><br />
<a href="http://www.espn.com">ESPN</a><br />
<a href="http://www.yahoo.com">Yahoo</a>
</p>
No.

You're suggesting:

<ul class="linkfont">
<li><a href="http://www.google.com">Google</a></li>
<li><a href="http://www.espn.com">ESPN</a></li>
<li><a href="http://www.yahoo.com">Yahoo</a></li>
</ul>

Yes! Except, name it class="urls" or similar.

..urls {
font-family: Helvetica, Arial, sans-serif;
font-size: 105%;
list-style-type: none;
...any other styles you want here
}

Oh, don't forget closing slashes: http://www.google.com/
And then add another css definition for how I like <UL>s to appear? Or can
I include the font style in the definition for the unordered list?

Please see:
http://www.w3schools.com/css/default.asp
http://htmldog.com/guides/cssbeginner/
 
P

(Pete Cresswell)

RE/
Class and ID names should describe the content, not the style.

Seems to me like nobody's answering the OP's root question:

Is it better to have five separate paragraphs, each with it's own 'class='
statement, or is it preferable to have a single paragraph/class statement and
four <br/> commands.

Or am I misunderstanding the question?
 
O

Oli Filth

(Pete Cresswell) said:
RE/



Seems to me like nobody's answering the OP's root question:

Is it better to have five separate paragraphs, each with it's own 'class='
statement, or is it preferable to have a single paragraph/class statement and
four <br/> commands.

Or am I misunderstanding the question?

I think the general consensus (with which I agree) is that neither
separate paragraphs nor a paragraph with breaks is a good semantic
description of what the OP requires.

An unordered list is appropriate (for that is exactly what the OP is
trying to construct), and that's what most people in this thread have
suggested.

Oli
 
B

Beauregard T. Shagnasty

(Pete Cresswell) said:

Please use the poster's name, instead of "RE". Thanks. You can set
your newsreader to do this for you.
Seems to me like nobody's answering the OP's root question:

I believe it has been answered.
Is it better to have five separate paragraphs, each with it's own
'class=' statement, or is it preferable to have a single
paragraph/class statement and four <br/> commands.

A "list" was described, therefore the correct markup would be the
Or am I misunderstanding the question?

;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top