Css unicode 显示空白矩形



我写了这个:

.Class{
Content: 'f0e8'
}

但它向我显示了一个空白矩形,而不是我想要的图标 有人知道为什么吗?

您只能在 ::after 和 ::before 伪元素中使用"content"。 尝试:

div::before {
content: '2193';
}

尝试以下操作:

.Class:before {
content: 'f0e8';
font-family: FontAwesome;
font-size: 20px;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<div class="Class">Hello</div>

最新更新