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

Ben Gustafson Ben_Gustafson at lionbridge.com
Mon Mar 18 11:30:01 CST 2002


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

--Ben



More information about the thelist mailing list