你能在CSS"content"属性中使用HTML实体吗?

cla*_*amp 26 html css

我想在CSS中使用HTML实体,但它显示了我•.

.down:before{
    content:"• ";
    color:#f00;
}
Run Code Online (Sandbox Code Playgroud)

另外,为什么上面的代码在IE中不起作用?它根本没有显示出之前的部分.

san*_*eep 58

像这样把你的子弹specal字符的十六进制值

div:before{
    content:"\2022";
    color:#f00;
}
Run Code Online (Sandbox Code Playgroud)

检查这个小提琴http://jsfiddle.net/sandeep/HPrkU/1/

注意:在IE8中工作之前和之后


twe*_*ked 8

我猜你想要显示实际的字符,如果是这样,只需使用字符代替•.

示例:http://jsfiddle.net/rmjt8/

编辑:我找到了另一个帖子:如何在CSS中包含HTML编码的"content:"字符?

也许这会验证:

.down:before{
    content:"\2022 ";
    color:#f00;
}
Run Code Online (Sandbox Code Playgroud)