Sunday, 13 July 2014

Three formats of calling css

Call using tag:
We can call a css using the tag like below.
 
 td {
    padding: 5px;
    text-align: left;
    background-color: #F2F2F2;
   }
Here all the attribute with td tag will be formatted with this css.

Call using id:
We can call a css using the id like below and the css will be applied to the particular attribute with this particular id.
 
 #p1
   {
     background-color: #00FF00;
     padding: 2px;
   }
Here all the attribute with td id 'p1' will be formatted with this css and while using id we should call id starting with a hash (#).
And in html file
 
 <div>

This call calls using id

</div>
Call using class:
We can call a css using the attribute 'class' like below and the css will be applied to the particular attribute with this particular class attribute.
 
 .p1
   {
     background-color: #00FF00;
     padding: 2px;
   }
Here all the attribute with td id 'p1' will be formatted with this css and while using id we should call id starting with a dot(.).
And in html file
 
 <div>

This call calls using class

</div>

No comments:

Post a Comment