View Single Post
Old 10-29-2007   #8 (permalink)
notjustgraphics
Rusty Bio-Hazard!
 
notjustgraphics's Avatar
 
Join Date: Sep 2006
Location: Toronto, Ontario, Canada
Posts: 1,163

Send a message via MSN to notjustgraphics
AgentXI's link is very helpful...

Actually, i learned a couple of things.

Still, the basic prinicple is that an ID assigns formatting that is unique whereas a CLASS assigns formatting that may apply to more than one object.

Indeed a DIV assigned an ID could also have a CLASS.

An example would be to use unique ID's to position a div while the CLASS assigned to it controls it's appearance such as border's, colors, text-alignments, etc...

Mike.

HTML Code:
#myDiv1 {
  width:100px;
  float:left;
}

#myDiv2 {
  width:200px;
  float:right;
}

.myClass {
  border:1px solid #fff;
  text-align:center;
  font-size:10px;
}
HTML Code:
<div id="myDiv1" class="myClass">
This div will be 100px wide and float left. The contents will be center aligned @ 10px font size. It will have a 1 pixel solid white border.
</div>

<div id="myDiv2" class="myClass">
This div will be 200px wide and float to the right. The contents will also be center aligned @ 10px font size. It too will have a 1 pixel solid white border.
</div>
__________________

Last edited by notjustgraphics; 10-29-2007 at 02:39 PM..
notjustgraphics is offline