I am trying to add a HTML special character using its code. It's working fine when I use it inside my div, but how can I do this using CSS.
I have tried as following.
.right-arrow:after {
content:'►'
}
<div>►</div>
<div class="right-arrow"></div>
.right-arrow:after {
content:'►'
}
What I wanted is not there in Matt Ball's answer because I wanted code for right arrow and in that question there is code for down arrow only. So it's not a duplicate.
Special characters work a little bit different with pseudo-elements. You can't use HTML entities in CSS, but you can use Unicode hex escapes. Here is a tool to convert the numeric value of the special character to the CSS value.
http://www.evotech.net/articles/testjsentities.html
for example ►
needs to be \25BA
working example:
.right-arrow:after {
content: '\25BA \25BC \25C0 \25B2'
}
<div class="right-arrow"></div>