Mark Fellowes wrote:
> I'm still having a hard time wrapping my mind around classes, in particular
> how they relate to classes in markup.
> So, I understand I can create a class like:
>
> .ptext{color: blue;}
>
> Then in the markup I can styple <p> with that class.
>
> What I find confusing is the uses of classes as opposed to id's in the
> markup. For example, I have a div for a right column. Would creating a class
> for the <p> section of that div in the markup make sense ?
>
> <div class=".ptext" id="#rightcol"></div>
>
> I just don't get why I want to insert class into markup or better, when and
> why ?
>
> I've read a number of articles and chapters on this, most recently the
> selecttutorial at "listamatic".
> Aint' helping ;)
>
> TIA
> Mark
ID and CLASS are in some ways inter-changeable. However, you should
only use ID once on a page, and you can use CLASS repeatedly. Also you
seem confused (like we all were once) between the way to mark up ID &
CLASS and the way the CSS is written.
So you could have:-
<div id="rightcol">
<p class="ptext">blah blue text blah</p>
<p>text in the default colour</p>
<p class="ptext">more blue text</p>
</div>
and your CSS might look (in part) like:-
div#rightcol {float: right; margin: 0; padding: 0;}
p.ptext {color: #00F; back-ground-color: #ABCDEF;}
Whether you'd need to float you column right is NOT the issue here, I
leave that to you !
Hope that helps
Tim
--
Tim Dawson,
Isle of Mull,
Scotland
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/