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 Odair 12.02.2014 в 23:50
source

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

    
answered by 12.02.2014 / 23:56
source