简体   繁体   English

内容忽略之前的伪元素\\在浏览器中

[英]Pseudo element before content ignoring \ in browser

I have this really basic issue I am trying to solve for a while now. 我现在有一段时间想解决这个非常基本的问题。 I am running out of all ideas. 我的所有想法都用光了。

I have a css pseudo-element before that I am styling like this. 在我这样设计之前,我有一个CSS伪元素。

#fPhone::before{
    color: #78be20;
    content: "\e622";
    font-family: icons;
}

But on the browser it just prints out 622. When I inspect the pseudo tag, I see 但是在浏览器上,它只是打印出622。当我检查伪标记时,我看到了

content: "e622";

If I try adding "\\" in the debugger it works but for some reason it doesn't pick it up from css. 如果我尝试在调试器中添加“ \\”,则可以正常运行,但是由于某种原因,它不会从CSS中获取。

I am running out of reasons that could be causing this. 我用尽了可能导致此问题的原因。

Sure you imported the icon-font correctly and are using the proper hexcode? 确定您正确导入了图标字体并使用了正确的十六进制代码? Below proof that it works as you may expect... 以下证明它可以按预期工作...

 @import url("https://fonts.googleapis.com/icon?family=Material+Icons"); #fPhone::before{ color: #78be20; content: "\\e0cd"; /* different code, but same effect */ font-family: 'Material Icons'; } /* class is pre-defined in @import (default <parent>color, 24px)*/ .material-icons { color: #78be20; font-size: 16px; } /* find the codes and ligatures for Material Icons at: https://github.com/google/material-design-icons/blob/master/iconfont/codepoints */ 
 <div id="fPhone"> a phone</div> <div><i class="material-icons">phone</i> using ligature name</div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM