/* The element with id="demo" */
#demo {
border: red 2px solid;
}ID selectors / notebook
ID selectors
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
#id_value {
/* … */
}[id="id_value"] {
/* … */
}<p id="blue">This paragraph has a blue background.</p>
<p>This is just a regular paragraph.</p><!-- The next two paragraphs have id attributes
that contain characters which must be escaped in CSS -->
<p id="item?one">This paragraph has a pink background.</p>
<p id="123item">This paragraph has a yellow background.</p>#blue {
background-color: skyblue;
}/* In the next two rules, the id attributes must be escaped */
#item\?one {
background-color: pink;
}
#\00003123item {
background-color: yellow;
}