Why doesn't the item id start with an integer?
They can. But the CSS ID selector cannot begin with a number. For example, this HTML is valid :
<div id="1foo">testing 1 2 3</div>
... but this CSS is not valid:
#1foo {
color: green;
}
CSS , id :
ID " " (U + 0023, #), ID, CSS.
CSS:
CSS ( , ) [a-zA-Z0-9] ISO 10646 U+00A0 , (-) (_); , , . ISO 10646 (. ). , "B&W?" "B\&W\?" "B\26 W\3F".
( .)
, #1foo, , CSS. :
HTML:
<div id="1foo">testing 1 2 3</div>
CSS
#\31 foo {
color: green;
}
... 31 - "1" . :
#\31 foo {
color: green;
}
<div id="1foo">testing 1 2 3</div>
Hide result, , . , , CSS. jQuery , FWIW. :.
$("#\\31 foo").css("color", "blue");
... . :
setTimeout(function() {
$("#\\31 foo").css("color", "blue");
}, 2000);
#\31 foo {
color: green;
}
<div id="1foo">testing 1 2 3, this should be green, and in two seconds it'll turn blue</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
Hide result( , , JavaScript, , , .)
, CSS ( HTML , ), . - Alien , . HTML CSS , , , id, HTML, DOM, . , , , , , . , .