CSS“内容”中的 HTML 特殊字符属性
我正在尝试使用 CSS :before + content: 字段在项目之前添加内容。我想插入一个复选标记 (☑),但如果我在内容选项中使用它,它会打印为文字。我如何告诉 CSS 使其成为复选标记,而不是文字字符串 ☑?
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 ☑?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
试试这个:
Try this:
您需要在
content
属性中使用 Unicode 值。 (杂项符号列表也可能有用。)重勾标记列为
U+2713
所以你可以输入content: "\2713";
You need to use Unicode values inside the
content
property. (The list of miscellaneous symbols may also be useful.)A heavy checkmark is listed as
U+2713
so you would putcontent: "\2713";
在 CSS 规则中按字面意思使用复选框字符而不是编码 -
请参阅:http://jsfiddle.net/e3Wt2/
Use the checkbox character literally in your CSS rule instead of the encoding -
See: http://jsfiddle.net/e3Wt2/