How can I select an element by class name containing a plus sign +
?
E.g.
.frme_150+1 {background-position: 150px 1px;}
The plus value is changed by using JavaScript, is this possible to use +
character in selector name?
You'd need to escape the plus sign as it has a special meaning in CSS, by using a leading backslash \
as follows:
.frme_150\+1 {
background-position: 150px 1px;
}
Working Demo.
Or escape the '+'
to '\2b '
or '\00002b'
(six hexadecimal digits)
Also, you can achieve this by using CSS Attribute Selector:
[class="frme_150+1"] { background-position:150px 1px; }
Working Demo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With