Re: Arranging of material

by "Tim Rivera" <lists(at)timrivera.com>

 Date:  Sun, 16 Nov 2003 23:24:47 -0500
 To:  <hwg-techniques(at)hwg.org>
 References:  midcoast midcoast2
  todo: View Thread, Original
> what is/are the '#' before the item names in the  style sheet? I see, an
> ID value - why that rather than a class selector, a flag '.' used.

In short, a period goes with a class, and a hash goes with an ID. Classes can be
used numerous times on a page, in multiple elements. ID's can be used only once
per page. The ID used for styling can also be used for JavaScript or a "named"
anchor. Older browsers have less support for ID's, for example Netscape
Navigator will not recognize an ID as a "named" anchor, and also may ignore
certain declarations within an ID (such as positioning.) That's the only
differences I can think of off the top of my head. Personally, I normally use
only classes. A few examples:

h2#top {text-decoration: underline}
p.red {border: 1px solid red}
.red {color: red}


<h2 id="top">Underlined title</h2>

<p class="red">In addition to red-colored text, this paragraph also
has a red border.</p>

<p>This text is the default color, but <span class="red">these
words</span> are red.</p>

<p><a href="#top">Back to Top</a></p>


HTH,

Tim
-- 
____________________________________________________________
http://webdesign.meetup.com/     See you at the next meetup!
http://css.meetup.com/

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA