I'm working with an HTML piece that I cannot modify. One of the ids in the document is:
<div id="a>span.tex"> ... </div>
>
.
You can escape special characters with a backslash:
#a\>span\.tex {
color: red;
}
<div id="a>span.tex"> Some funky ID </div>
You can even use backslashes within your ID as long as you escape them with another backslash:
#a\\span\\tex {
color: red;
}
<div id="a\span\tex"> Some funky ID </div>
In fact, lots of crazy strings are valid IDs in HTML5
#\¯\\\_\(\ツ\)\_\/\¯ {
color: red;
}
<div id="¯\_(ツ)_/¯"> ¯\_(ツ)_/¯ - but why would you? </div>