Class vs. Id in CSS - CSS Views : 338
Tagged in : CSS
0 0
Send mail
Class vs. Id

Use an Id for elements that are used once and only once on a page

The HTML:
<div id="content"></div>



The CSS:

#content {background: #fff}



Use a class for elements that may be reused on the page

The HTML:
<p class="large-text">
</p>


The CSS:
.large-text {font-size: 1.4em}





By Rekha, On - 2010-03-30



    Login to add Comments .