[thelist] css class vs id

David Dorward david at david.us-lot.org
Fri May 10 07:55:01 CDT 2002


On Fri, May 10, 2002 at 09:30:16AM +0200, Steve Cook wrote:
> If you check the archives you'll see that there was a discussion of this a
> couple of months back. However, the main point is that an ID should only
> exist once in a layout. So you could have something like
>
> <p id="title">Main title - style used only once</p>
>
> <p class="subtitle">Subtitle - used continuously throughout the layout</p>

Bad example, not all browsers understand CSS, and not everybody uses
browsers that render pages visually.

<h1>Main title</h1>

and

<h2>Subtitle</h2>

are much better.

<div id="mainmenu">Your menu here</div>

and

<img class="thumbnail" ...>

are possible better examples of id and class.

--
David Dorward                                   http://david.us-lot.org/
HTML email is a bit like using coloured paper and glitter ink on a CV.



More information about the thelist mailing list