HTML Id Attribute



HTML id attribute is used to create a unique id for an HTML tag.

it is used by javascript and css to action a specific task for an unique HTML element.

Example

<!DOCTYPE html>
    <html>
    <head>
      <title>Id Attributes</title>
      <style>
        #main {
          color:red;
          font-size:60px;
          font-weight:bold;
          text-align:center;
        }
        #one {
          text-align:center;
          font-size:20px;
        }
      </style>
    </head>
    <body>
      <div id="main">Element Tutorials</div>
      <div id="one">Coding Made easy</div>
    </body>
    </html>					
    
  
  


Click on the "Run This Code" button to see how it works.





HTML

Welcome HTML Getting Started HTML Elements HTML Attributes HTML Headings HTML Paragraphs HTML Links HTML Styles HTML Text Formatting HTML Tables HTML Images HTML Forms HTML Lists HTML Iframes HTML Comments HTML CSS HTML Colors HTML Classes HTML Id HTML javascript HTML Filepaths

HTML Advanced

HTML Doctypes HTML Validation HTML Validation HTML URL HTML URL Encode HTML URL Entities HTML Layout HTML Head HTML Meta HTML Scripts HTML Tags

HTML Media

HTML Media HTML Audio HTML Video HTML Plug-ins HTML Youtube

HTML Graphics

HTML Canvas HTML SVG