Wednesday, September 21, 2011

12 - id and class Selectors


 So far we are styling our Selector Tags with the same 
 name. for ex:


h1{
         color:blue;
         font-size:16px;
}

We can also style our Selectors Tags by id and class.

 For defining id we use "#" and for class we use "." (dot). for ex:

 
Define all id and class in inline or external CSS.


<!--ID-->

  #myTextID{
              color:#03C;
              font-size:20px;
             }

 <!--Class-->

  .myTextClass{
              color:#0CF;
              font-size:20px;
             }

 
<p id="myTextID"> This paragraph is defined with ID</p>

<p class="myTextClass"> This paragraph is defined with Class</p>

Output in Browser:



 powered by multimediagyan ©

No comments:

Post a Comment