RE: CSS questions

by "Kali Woodbridge" <kaliajer(at)mail.com>

 Date:  Sun, 20 Aug 2000 13:49:56 -0400
 To:  <webdiva(at)webdiva.screaming.net>,
"'Hwg-Basics(at)Mail.Hwg.Org'" <hwg-basics(at)mail.hwg.org>
 In-Reply-To:  screaming
  todo: View Thread, Original
Greetings & Felicitations--

<snip>
I have one quick question, whats the difference between class and id
e.g.
"<p class="pl">" and "<p id="pl">"
</snip>

"The ID attribute works like the CLASS attribute with one important
difference: the value of an ID attribute must be unique throughout the
document. That is, every element inside BODY can have an ID attribute,
but the values must all be different."

Also, to define an ID attribute, you need to declare it with the
correct flag character. The ID flag character is the hash (#) mark.
Using your sample above, the CSS would be written:
#pl (text decoration: underline}
.pl {text decoration: underline}
--

In your BODY, you would write:
<P CLASS="pl">Show this text underlined</P>
<P ID="pl">Show this text underlined</P>

---

You would most likely not use the same name for 2 different attribute
declarations. And, you can only call the ID attribute ONCE within the
document. Separate instances of the ID must each have different ID
values (#pl, #pm, #pn, etc,).

My resource for this is "Cascading Style Sheets-- Designing for the
Web" by Hakon Wium Lie (the guy who practically invented CSS)  and
Bert Bos, second edition.

The Web Monkey tutorials on CSS are great. I highly recommend them as
well.

Happy Sunny Sunday to All!

kali

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA