CSS中的HTML特殊字符“content”属性 [英] HTML special characters in CSS "content" attribute

查看:522
本文介绍了CSS中的HTML特殊字符“content”属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用CSS:before + content:fields之前的内容添加到项目之前的内容。我想插入一个复选标记(☑),但如果我在内容选项中使用它,它打印为文字。

I'm trying to add content to something before an item using the CSS :before + content: fields. I want to insert a checkmark (☑), BUT if I use that in the content option, it prints as the literal. How can I tell CSS to make that a checkmark, not the literal string ☑?

推荐答案

试试这个:

#target:before {
  content: "\2611";
}

这篇关于CSS中的HTML特殊字符“content”属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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