ID selectors

suggest change

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">
    <p>Example</p>
</div>

…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

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents