CSS:在内容中编码字符之后 [英] CSS:after encoding characters in content

查看:136
本文介绍了CSS:在内容中编码字符之后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是以下CSS,它似乎是工作:

I am using the following CSS, which seems to be working:

a.up:after{content: " ↓";}
a.down:after{content: " ↑";}    

字符不能像这样编码,因为输出是文字的,并显示实际的字符串:

The characters however cannot seem to be encoded like this, as the output is literal and shows the actual string:

a.up:after{content: " ↓";}
a.down:after{content: " ↑";}   

如果我不能编码,感觉像我应该使用像japp中的.append(),因为它支持编码。任何想法?

If I can't encode it, it feels like I should use something such as .append() in jQuery, as that supports the encoding. Any ideas?

推荐答案

要在 content 中使用编码的Unicode字符提供字符本身(如你所做),或者它们的UTF-8转义序列,而不是HTML实体:

To use encoded Unicode characters in content you need to provide either the characters themselves (as you do), or their UTF-8 escape sequences instead of HTML entities:

a.up:after { content: " \2193"; }
a.down:after { content: " \2191"; }   

这篇关于CSS:在内容中编码字符之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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