How to add ascii characters to css /:before:after
How to add characters in front of a link/before a link in css?
Or how to add characters after every link in css?
Let’s say you want to add an ascii character after in front of every link,
because you want to add some detail, yet you dislike the use of images…
Actually it’s easier than you think, here is how:
a:before
{
content: "\3E \ ";
}
This will render likes like this:
> home
Why is the “>” \3E\? You will have to use the HEX code instead of the ascii one in combination with content:
To see a full ascii / hex chart with examples, a good overview, go here
In case you want to append/add content, e.g. a full sentence or a word, after your link you will have to use
a:after
{
content: " days till shazam";
}
This can be used in combination with database queries that output plain numbers such as “30″, you’d then just add a div around it (change a:after to #id:after) and shazam you will get “30 days till shazam“.
I hope this helps anyone.
*note: you will have to use the hex format, because Unicode entities such as (‖) are not supported in combination with content:
what is the ascii code for that downward and upward arrow, right afer the link on your website? thanx
actually i can get it to work on IE (yeah.. i know.. ie sucks).. am i missing something to work properly on IE?
i can“t i meant.. :P
@Andy: hey mate, this is not supported by Internet Explorer, I had to find out the hard way, too.
Might want to look into “javascript IE fix” by dean edwards (google project)