CSS:在上标"6"之前?
是否可以将上标"6"添加到伪元素的"content" CSS属性中?我遍历整个网络,尝试使用不同的Unicode字符串和字形代码尝试使其工作,但尚未找到解决方案.
Is there a way to add a superscript "6" into the "content" CSS property for a pseudo element? I've been all over the web, trying different Unicode strings and glyph codes to try to get this to work, but haven't found a solution.
谢谢!
抱歉,我们无法澄清...我需要将上标"6"与其他文本放在相同的"content"属性中.看起来我只需要为CSS定义不同的编码,然后将其作为文字字符放入即可.
Sorry for not clarifying... I'm needing to put the superscript "6" amongst other text in the same "content" property. Looks like I'll need to just define a different encoding for my CSS and drop it in as a literal character.
span:before {
content: "⁶";
}
在这种情况下,您可能必须小心使用和指定的编码.
You may have to be careful with encodings used and specified in this case, though.
如BoltClock所述,如果您担心编码问题(例如,如果您的服务器强制使用旧版代码页并且您无法更改),则还可以将字符转义为 \ 2076
.
As BoltClock mentions, you can also escape the character as \2076
if encoding problems are a concern (e.g. if your server forces legacy codepages and you cannot change that).