Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to display euro symbol in css after and before pseudoelements

I can't figure out how to let CSS display the Euro symbol (€) in :before and :after pseudoelements.

.my-span:after {
    content: '€';
}

Tried with the symbol , u20AC and %u20AC. Nothing seems to work.

Thanks in advance.

like image 994
Alan Piralla Avatar asked Dec 06 '13 17:12

Alan Piralla


People also ask

How do you put a copyright symbol in CSS?

CSS doesn't use HTML's entities; it uses its own unicode escape sequences. You need to use \00a9 for the copyright symbol.

What number code would you use to create the euro symbol?

Inserting the euro symbol using an Alt keyboard shortcut Position the cursor where you want to insert the euro symbol. Press and hold Alt + 0128 on the numeric keypad.


2 Answers

Using the character “€” as such works provided that the declared character encoding of the CSS file (or, if the style sheet appears inside an HTML file, of the HTML file) coincides with the actual encoding.

Since servers normally do not specify character encoding for CSS files, it should suffice to save the file as UTF-8 encoded with BOM. The BOM lets browsers auto-recognize the encoding.

If this is not feasible, use the method mentioned by @Alohci: '\20AC'. This is a CSS escape that works independently of character encodings, but it’s not particularly readable.

like image 153
Jukka K. Korpela Avatar answered Sep 22 '22 20:09

Jukka K. Korpela


You should just be able to use the symbol - http://jsfiddle.net/8Wz9B/

.my-span:after {
    content: '€';
}
like image 22
Advocation Avatar answered Sep 23 '22 20:09

Advocation