Re: Difference between class and id
by "Timothy J. Luoma" <luomat(at)peak.org>
|
| Date: |
Mon, 27 May 2002 12:54:22 -0400 (Eastern Daylight Time) |
| To: |
Gabriel <ghrivera(at)sinectis.com.ar> |
| Cc: |
hwg-style(at)hwg.org, <www-style(at)w3.org> |
| In-Reply-To: |
ahurman |
| |
todo: View
Thread,
Original
|
|
On Mon, 27 May 2002, Gabriel wrote:
> What's the difference between using <div id=smth> and <div class=smth>
> (and <div id=smth1 class=smth2>)?
> Are they supposed to have different content?
Basically, you can only have one ID of a certain value per page, but you
can reuse classes all you want.
For example, this would be legal to have on one page
<div id="top" class="paragraph"> .... </div>
<div id="middle" class="paragraph"> .... </div>
<div id="bottom" class="paragraph"> .... </div>
but this would not:
<div id="paragraph"> ... </div>
<div id="paragraph"> ... </div>
<div id="paragraph"> ... </div>
You can also make links to 'id' tags
'id' tags can also be used for other elements other than DIV
TjL
ps -- be sure to quote your values in class and id and other attributes...
using lowercase is also good.... you'll thank me one day when you start to
use XML/XHTML for the habits you develop today
HWG hwg-style mailing list archives,
maintained by Webmasters @ IWA
This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.