CSS:在上标"6"之前? [英] CSS :before superscript "6"?

查看:30
本文介绍了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).

这篇关于CSS:在上标"6"之前?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆