-->

how to add a dollar sign through css content

2019-06-28 03:20发布

问题:

How can I display the "$" sign through CSS Content:" " I've tried all kinds of different codes. Putting just

div.example {Content:"$1000";}

displays on the site like "00".

Trying to do this before resorting to Javascript.

回答1:

.dollar:before {
    content: '$';
}


回答2:

You can use the following code for displaying the dollar sign in the CSS content property

div.example { content: "\0024"; }


回答3:

There isn't quite enough HTML to go on, but to take a shot:

The CSS property content is to be used with ::before and ::afterand when i put a $ inside my content declaration, everything works...

See JSfiddle here