[thelist] Re: Learning CSS - what's the # for + any good tutorials?

Tyme nopun at bellsouth.net
Mon Mar 18 13:14:01 CST 2002


----- Original Message -----
From: "Ben Gustafson" <Ben_Gustafson at lionbridge.com>
To: <thelist at lists.evolt.org>
Sent: Monday, March 18, 2002 12:42 PM
Subject: [thelist] Re: Learning CSS - what's the # for + any good tutorials?


> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
> --
> [ Picked text/plain from multipart/alternative ]
>
> > What advantages are there to assigning styles to a specific
> > division (by ID) instead of setting up a style class and using that?
> > ...
> > Thanks,
> >
> > Simon (determined to get to grips with CSS now)
>
> A general rule that I follow: Use an ID when you want to apply a style to
> one specific item (DIV, P, etc.), and a class when you want to apply a
style
> to more than one.
>
> /* for an ID that's unique in a page: */
> #head {
> visibility: visible;
> }
>
> /* for an ID that's unique among the DIVs in a page: */
> DIV#head {
> visibility: visible;
> }
>
> /* a class for any number of P tags in a page: */
> P.bodyText {
> font-size: 10pt;
> }

TYME} An ID is meant to be unique.  When you are assigning IDs, keep your
design flexible.  If you later want to manipulate that element with
Javascript, for example, your container names will be very important and
must not disagree with each other.




More information about the thelist mailing list