Table of Contents

HTML Identifiers

HTML Identifiers or ID's are used to uniquely identify an element. Adding an ID to an element will make it easy to reference when you need to add some functionality or style to your element. Take a look at an example of adding an ID to the following div element:

<div id="box"></div>

Above we have given our element and ID of box, so now we can use this ID to reference our element. As an example we could give our box id element the following styles in CSS.

#box{
    width:200px;
    height:200px;
    background:blue;
}

When writing CSS we can use the # sign to reference an elements ID. So, if we had the HTML and CSS code from above we would have the following result:

HTML Identifier Example

When using an ID, you will only have one of these in your HTML page, if you wish to have multiple elements with the same properties and functionality you will want to use an HTML Class. Let's move on to talking about classes in the next section.