I was toying around with the :before
pseudo class in css, trying to insert a special character but the result is not what I was hoping for.
Using:
.read_more:before {
content: "»";
margin-right: 6px;
}
I get the character I want, but with an  character before it and using:
.read_more:before {
content: "»";
margin-right: 6px;
}
I get the complete »
on the html page.
I can think of a couple of ways to solve my problem, but I was wondering what the correct syntax would be if I wanted to use the :before
pseudo class.
By the way, my doctype is:
<!doctype html>
<html lang="en">
I know it's been a while since this question was asked but in case someone might need it nowadays, I found the solution for it.
Here's a chart with lots of glyphs. Find the one you want and copy the hex code for it.
Then paste it here to convert.
You'll get a value that looks like this: \00E1 (CSS Value)
Paste this value on your 'content:' and be happy :)
Add this on the html, inside the
<head>
sectionBut if the html page is coded in PHP, I would prefer the following:
And don't forget to save any file (css, html, php) with UTF-8 encoding
try this
\00BB is the unicode representation of that character. It should reasonably works =)
The answer has been already told, but I want to refer to:
That's because CSS
content
property isn't treated as HTML. It's not appended to the DOM, therefore any HTML-specific markup isn't parsed. You can insert a character directly:content: "Ԃ";
or use Unicode notation:content: "\0504";
.Your browser isn't using the correct text encoding -- that is, it isn't using the same text encoding as your editor. If you are receiving the page from a Web server, the best approach is to make sure the server is sending the proper Content-Type header. If you don't have control over the Web server's headers, or if you will be doing a lot of testing using local HTML files, add appropriate tags to your document for the encoding and HTML version you are using. I recommend using UTF-8. The CSS file (if it is separate from the HTML) should use the same encoding.
Try specifying
<meta charset="utf-8">
. Ideally you want to set this in the server.