如何使用CSS内容属性来添加HTML实体?
使用像这样的东西只是打印 返回到屏幕上,而不是不间断的空格:
.breadcrumbs a:before {
content: ' ';
}
如何使用CSS内容属性来添加HTML实体?
使用像这样的东西只是打印 返回到屏幕上,而不是不间断的空格:
.breadcrumbs a:before {
content: ' ';
}
当前回答
你必须使用转义的unicode:
Like
.breadcrumbs a:before {
content: '\0000a0';
}
更多信息:http://www.evotech.net/blog/2007/04/named-html-entities-in-numeric-order/
其他回答
使用十六进制代码表示不间断的空格。就像这样:
.breadcrumbs a:before {
content: '>\00a0';
}
这里有两种方法:
在HTML中: < div class = " ics”> & # 9969;< / div >
这将导致 ⛱
在Css中: .ics::before{内容:"\9969;"}
与HTML代码<div class="ics"></div>
这也导致了⛱
例如:
http://character-code.com/arrows-html-codes.php
例子:如果你想选择你的角色,我选择“↬”“↬”(我们使用十六进制值)
.breadcrumbs a:before {
content: '\0021ac';
}
结果:↬
就是这样。
为了让答案更完整一点。如果您正在使用content: attr(aria-label);,那么您需要使用HTML实体而不是unicode转义。例如,使用 生成换行符。
你必须使用转义的unicode:
Like
.breadcrumbs a:before {
content: '\0000a0';
}
更多信息:http://www.evotech.net/blog/2007/04/named-html-entities-in-numeric-order/