how to add a dollar sign through css content
Asked Answered
F

3

6

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.

Flowage answered 2/5, 2015 at 1:14 Comment(1)
Please show any applicable HTML as well.Bottomry
C
17
.dollar:before {
    content: '$';
}
Citizenship answered 2/5, 2015 at 1:16 Comment(1)
Modern usage is ::. From MDN, CSS3 introduced the ::before notation (with two colons) to distinguish pseudo-classes from pseudo-elements. -- developer.mozilla.org/en-US/docs/Web/CSS/::beforeCasuist
B
1

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

div.example { content: "\0024"; }
Bergman answered 12/6, 2015 at 6:42 Comment(0)
D
0

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

Denman answered 2/5, 2015 at 1:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.