ID selectors
suggest changeID 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
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents