Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add html special character (right-arrow) using content property of css? [duplicate]

Tags:

html

css

I am trying to add html special character using its code. Its working fine when I use it inside my div but how can I do this using css.

I have tried as following.

.right-arrow:after {     content:'&#9658' } 

DEMO

EDIT

What I wanted is not there in Matt Ball's answer because I wanted code for right arrow and in that question there is code for down arrow only. So its not duplicate.

like image 519
Jay Shukla Avatar asked Aug 12 '13 11:08

Jay Shukla


People also ask

How do I use special characters in CSS?

Special characters in CSSEither you use the Unicode code point — for example, the plus sign ( + ) is U+002B, so if you would want to use it in a CSS selector, you would escape it into \2b (note the space character at the end) or \00002b (using exactly six hexadecimal digits).


2 Answers

Special characters work a little bit different with pseudo-elements. You can't use HTML entities in CSS, but you can use Unicode hex escapes. Here is a tool to convert the numeric value of the special character to the CSS value.

http://www.evotech.net/articles/testjsentities.html

for example &#9658 needs to be \25BA

working example:

http://jsfiddle.net/L6suy/

.right-arrow:after {     content:'\25BA' } 
like image 157
koningdavid Avatar answered Sep 21 '22 08:09

koningdavid


<div class="right-arrow">Arrow</div> .right-arrow:before {     content:'\25BA'; } 

See Demo Here

like image 42
Vikas Ghodke Avatar answered Sep 24 '22 08:09

Vikas Ghodke