HTML Id

An id is an attribute used to specify a unique id for an HTML element. An ID selector is a name preceded by a hash character (“#”).

Id Breakdown

Here is the breakdown of HTML Id

Id Example

Below example will demonstrate the basic architecture of HTML Id.

<!doctype html>  
<html>

    <head>
        <title>ID Example</title>
        <style>
            #top {
                background-color: #ccc;
                padding: 20px
            }
        </style>
    </head>

    <body>
        <div id="top">
          <h1>PHPDocs</h1>
        </div>
    </body>

</html>