2011-10-14 62 views
38

解决 - 使用\00a9代替©版权符号在CSS:after伪元素

不言自明:

body:after { 
    content: "© me"; 
    /* other formatting */ 
} 

在HTML中,©序列插入一个版权的字符。这可以在CSS Pseudo-Elements中完成,就像我在这里要做的一样?

+0

的可能重复[CSS:在内容编码字符后(HTTP:/ /stackoverflow.com/questions/5030551/cssafter-encoding-characters-in-content) –

回答

62

CSS不使用HTML的实体;它使用自己的unicode转义序列。

您需要使用\00a9作为版权符号。

body:after { 
    content:"\00a9 me"; 
} 

在这里看到了备忘单表,它表明几乎所有的实体/ Unicode的你在任何时候需要字符串:http://www.evotech.net/blog/2007/04/named-html-entities-in-numeric-order/

+2

我刚刚发现我的答案是类似的问题,说同样的事情。现在我觉得真的很愚蠢,以不同的方式回答这个问题。 http://stackoverflow.com/questions/5030551/cssafter-encoding-characters-in-content/5030594#5030594 – BoltClock

+1

是的。这是正确的。 – Brent

+1

很酷,不知道这个。 +1 –