How to use escape character in CSS?

6

I'm trying to insert a special character in the :before of my links so they look like this:

➔ This is the link

The problem is that this character is written in hexadecimal and when I try to put it in content:'➔' instead of displaying the figure it displays its hexadecimal value and looks like this:

➔ Esse é o link

Is there a CSS escape character?

    
asked by anonymous 12.02.2014 / 23:50

1 answer

9

You can simply use the literal character (as noted by Emerson Rocha Luiz, the CSS file - and possibly also HTML - should be saved with UTF-8 encoding):

a:before { content: "➔"; }

Or the unicode character code in hexadecimal format, escaped with \ . You were using code 10132 in decimal, which is 2794 in hexadecimal:

a:before { content: "94"; }

Demo

    
12.02.2014 / 23:56