Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Which is the proper way?

Reply
Thread Tools

Which is the proper way?

 
 
Neal
Guest
Posts: n/a
 
      12-20-2004
On Mon, 20 Dec 2004 20:48:18 GMT, paul j <(E-Mail Removed)>
wrote:

>>> 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>


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>.

 
Reply With Quote
 
 
 
 
Neal
Guest
Posts: n/a
 
      12-20-2004
paul j wrote:

> 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.
 
Reply With Quote
 
 
 
 
paul j
Guest
Posts: n/a
 
      12-20-2004
On Mon, 20 Dec 2004 20:56:56 +0000, Steve Pugh wrote:

> On Mon, 20 Dec 2004 20:48:18 GMT, paul j <(E-Mail Removed)>
> wrote:
>
>>On Mon, 20 Dec 2004 20:42:53 +0000, Steve Pugh wrote:
>>
>>> On Mon, 20 Dec 2004 20:35:27 GMT, paul j <(E-Mail Removed)>
>>> wrote:
>>>
>>>>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.
>>>

>>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


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?
--
Up from Third Base to Huntington
They sang another victory song...........
 
Reply With Quote
 
Kris
Guest
Posts: n/a
 
      12-20-2004
In article
<gt8mmyyp6gy0.dlg@P7Ax8zefAz8re8ranuGa9rebruMUdruP HeYaPrabru9haSE5r56reT
hufrufRu4p.org>,
paul j <(E-Mail Removed)> wrote:

> 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?


Maybe this will help, http://www.alistapart.com/articles/taminglists/

--
Kris
<(E-Mail Removed)> (nl)
 
Reply With Quote
 
Steve Pugh
Guest
Posts: n/a
 
      12-20-2004
On Mon, 20 Dec 2004 21:13:26 GMT, paul j <(E-Mail Removed)>
wrote:
>On Mon, 20 Dec 2004 20:56:56 +0000, Steve Pugh wrote:
>> On Mon, 20 Dec 2004 20:48:18 GMT, paul j <(E-Mail Removed)>
>> wrote:
>>>On Mon, 20 Dec 2004 20:42:53 +0000, Steve Pugh wrote:
>>>>
>>>> Neither. If it is a list as your class name suggests then the correct
>>>> markup must be list markup.
>>>>
>>>> Then use CSS if you want to remove the list markers.
>>>>
>>>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.

>
>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

 
Reply With Quote
 
Beauregard T. Shagnasty
Guest
Posts: n/a
 
      12-20-2004
paul j wrote:

> 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/

--
-bts
-This space intentionally left blank.
 
Reply With Quote
 
(Pete Cresswell)
Guest
Posts: n/a
 
      12-21-2004
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?
--
PeteCresswell
 
Reply With Quote
 
Oli Filth
Guest
Posts: n/a
 
      12-21-2004
(Pete Cresswell) wrote:
> 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?


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
 
Reply With Quote
 
Beauregard T. Shagnasty
Guest
Posts: n/a
 
      12-21-2004
(Pete Cresswell) wrote:
> RE/


Please use the poster's name, instead of "RE". Thanks. You can set
your newsreader to do this for you.

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

>
> 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
previously mentioned <ul><li>. His sample (several URLs that he in
fact called a "list) was not a paragraph.

> Or am I misunderstanding the question?




--
-bts
-This space intentionally left blank.
 
Reply With Quote
 
Neal
Guest
Posts: n/a
 
      12-21-2004
Pete Cresswell wrote:

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


I said this, NOT some "RE/". Please attribute.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Microcontrollers: which one ? which language ? which compiler ? The Jesus of Suburbia NZ Computing 2 02-11-2006 06:53 PM
Which is the proper header to include for std::pair? Eric Lilja C++ 5 03-04-2005 11:17 PM
Proper way to install the Bird & the Fox? @micro$oft.linuxworx Firefox 0 04-25-2004 04:22 AM
Which is proper/correct David McCallum Java 6 01-16-2004 04:32 PM
Which is a good UK web hosting company that lets u see proper stats? xyZed HTML 3 06-29-2003 07:05 PM



Advertisments