CSS ID selectors


ID selectors select DOM elements with the targeted ID. To select an element by a specific ID in CSS, the # prefix is used.

For example, the following HTML div element…

<div id="exampleID">

…can be selected by #exampleID in CSS as shown below:

#exampleID {
    width: 20px;

Note: The HTML specs do not allow multiple elements with the same ID