Testthis code does not work #languageForm:j_id42...">

CSS dot selector?

how can i select a div?

<div id="languageForm:j_id427:0:j_id432">Test</div> 

this code does not work

 #languageForm:j_id427:0:j_id432 { color:#00aa00; } 

. ,,,,,,,,,.

+4
source share
2 answers

: - special character in CSS ( :hover )

Use \00003A to avoid this:

 #languageForm\00003Aj_id427\00003A0\00003Aj_id432 { color:#00aa00; } 

jsfiddle

Note. Do not use \: because it does not work in IE7 .

Why are many 0 s? Because the browser will try to read no more than 6 characters to parse the unicode constant in CSS files. Without zeros, he would read \3Aj and stop with an error.

+7
source

Your selector contains : so you need to avoid them with a backslash \ , use this

 #languageForm\:j_id427\:0\:j_id432 { color:#00aa00; } 

Demo

Note. Maybe older browsers will not be able to escape, in which case you can use \ 3a, which is equivalent to a colon.

 #languageForm\3a j_id427\3a 0\3a j_id432 { color:#00aa00; } 

Demo (note the spaces after \3a )

(Pay attention to the answer of the Aarons if you go with the solution ( \3a ))

+2
source

Source: https://habr.com/ru/post/1491599/


All Articles