how to add a dollar sign through css content

谁都会走 提交于 2020-01-03 17:11:21

问题


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



来源:https://stackoverflow.com/questions/29997297/how-to-add-a-dollar-sign-through-css-content

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!