html5 - How to select an element that has id starting with a digit (css)? -


<div id="634670717473476800" align="center" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"> 

i have above html (autogenerated, cannot change) , try select entire div in css. there several "wcustomhtml" on page id choice. straightforward think.

but not able select it. don't understand.

neither #634670717473476800 nor div#634670717473476800 manages select div. can 1 not select id consisting of numbers only?

edit: if valid html, can wrong. neither chrome inspect element, nor firebug let's me create rules based on id in inspector.

you can access way:

css:

[id='634670717473476800']{     background-color:red; } 

demo:

https://jsfiddle.net/h82bvpeh/1/

or escaping:

css:

#\36 34670717473476800{     background-color:green; } 

demo:

https://jsfiddle.net/h82bvpeh/2/

citing https://mathiasbynens.be/notes/css-escapes:

if first character of identifier numeric, you’ll need escape based on unicode code point. example, code point character 1 u+0031, escape \000031 or \31 .

basically, escape numeric character, prefix \3 , append space character ( ). yay unicode!

about html5 id http://www.w3.org/tr/html5/single-page.html#the-id-attribute:

there no other restrictions on form id can take; in particular, ids can consist of digits, start digit, start underscore, consist of punctuation, etc.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -