@the_treeApr 07.2005 — #[b]First question:[/b] the hash refers to an elements id, the period refers to an elements class, if there were niether, it'd refer to an element.
[b]Second question:[/b] when refering to an elements class, a period is always used; when declaring an elements class, a period is never used.
[b]Edit[/b] Crud buckets, I never saw your second post. An id is unique, it can only be used once. A class gets used lots of times, and an element have a selection of classes.
@lilqhgalauthorApr 07.2005 — #the tree, thanks for the quick reply.
Regarding the second answer: Can you "dumb" that down a little for me? :o I'm fairly new to css, only really using it for basic font styling, so really don't know the difference or when/why you would use one vs. the other.
@the_treeApr 07.2005 — #An id is unique, it can only be used once. A class gets used lots of times, and an element have a selection of classes. Example:[code=html]<ul id="navigation"> <li id="active"><a href="page.htm">Home</a></li> <li><a href="page.htm">Catorgries</a></li> <li class="newcontent"><a href="page.htm">Projects</a></li> <li class="unimportant"><a href="page.htm">Archives</a></li> <li class="unimportant"><a href="page.htm">Contact</a></li> <li class="unimportant newcontent"><a href="page.htm">FAQ</a></li> </ul>[/code]
Warning: some of the patterns show are not fully supported in all browsers. Check [URL=http://www.csscreator.com/attributes/]support[/URL] before using.
@toicontienApr 07.2005 — #Browsers, when applying the style to a page, treat IDs and classes the same. You can give more than one HTML tag the same ID and the browser will apply the styles for that ID to each tag. The [url=http://validator.w3.org/]W3's HTML validator[/url] will give you an error if an ID is on a page more than once. And if you get into DHTML and use the document.getElementById method to grab a reference to an HTML tag, you'll get a JavaScript error if you try to use an ID that's on the page more than once.
@FangApr 07.2005 — #[B]toicontien[/B] IE can reference multiple ID's (with the same value) as a collection. Gecko is going to build in the same functionality albeit switchable. ?
@toicontienApr 07.2005 — #Strange. I thought getting a collection of elements was best suited for using classes and the document.getElementsByClassName method. At least I think that's the method, right off hand.