Css:- Id selector

    The #id selector styles the element with the specified id.
    The selected element's ID attribute must match exactly the value given in the selector.
    Code:- 
      <!DOCTYPE html> 
      <html> 
       
      <head> 
       <meta name="viewport" content="width=device-width, initial-scale=1"> 
       
       <style> 
        /*When you want to select using class name you can just put dot(.) before the class name*/ 
        /*When you want to select using id you can just put hash(#) before the class name*/ 
         
        .clsname { 
         background-color: red; 
        } 
         
        #divid { 
         background-color: green; 
        } 
       </style> 
       
      </head> 
       
      <body> 
       
       
       <div> 
        Test Div 
       </div> 
       
       <div class="clsname"> 
        This div have class name 
       </div> 
       
       <div id="divid"> 
        This div have id 
       </div> 
       
      </body> 
       
      </html>

Css:- Id selector Css:- Id selector Reviewed by Network security on May 23, 2019 Rating: 5

No comments:

Useful Information

Powered by Blogger.