The Most Active and Friendliest
Affiliate Marketing Community Online!

“Adavice”/  “CPA

Class or ID?

ForumJoiner

New Member
affiliate
A div is like a blank container. To set the properties of a div, we’ll associate it a class or an id and then set the properties for that class / id.


If we want to use the properties on more than one div, we’ll use classes. Otherwise, we’ll use ids.


In the CSS file, class names start with . while ids names start with #.


Using classes:
  • in the HTML file
    Code:
    <div [B]class = "common"[/B]>
            ... div's content ...
    </div>
  • in the CSS file
    Code:
    [B].common[/B]
    {
    	color : blue;
    }



Using ids:
  • in the HTML file
    Code:
    <div [B]id = "unique"[/B]>
            ... div's content ...
    </div>
  • in the CSS file
    Code:
    [B]#unique[/B]
    {
    	color : blue;
    }
 
MI
Back