What is the difference between class selectors and id selectors?


An overall block is given to class selector while id selectors take only a single element differing from other elements.

CSS Class Selector

<style>    
.center {    
    text-align: center;    
    color: blue;    
}    
</style>  

CSS Id Selector

<style>    
#para1 {    
    text-align: center;    
    color: blue;    
}    
</style>    
   

Leave a Reply

Your email address will not be published. Required fields are marked *