欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 前端技术 > CSS >内容正文

CSS

via css书签,Unicode via CSS :before

发布时间:2024/5/14 CSS 88 豆豆
生活随笔 收集整理的这篇文章主要介绍了 via css书签,Unicode via CSS :before 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):

问题:

I am using Font Awesome on my webpage and I want to display an icon inside the :before pseudo element.

According to the documentation/cheatsheet, I have to type  to get this font, but it isn't working. I believe that is normal because HTML entities aren't supported in :before.

So I googled a bit and found out, that if you want to display HTML entities in :before, you have to use the escaped hex reference.

So I was searching for the hex reference to  but I found nothing. I believe that is because these are "private use" values, whatever that means.

Is there any way to get it working in :before?

回答1:

The escaped hex reference of  is \f066.

content: "\f066";

回答2:

In CSS, FontAwesome unicode works only when the correct font family is declared (version 4 or less):

总结

以上是生活随笔为你收集整理的via css书签,Unicode via CSS :before的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。