nbsp 不适用于 CSS 内容标签

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2965229/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 22:10:23  来源:igfitidea点击:

nbsp not working in CSS content tag

css

提问by NibblyPig

Possible Duplicate:
Adding HTML entities using CSS content

可能的重复:
使用 CSS 内容添加 HTML 实体

#sitenavmenu-content-menu li:before
{
    content:"|  ";
}

I want to add a | and two spaces before each list item. However, for some reason it prints the word nbsp and not the space. Any ideas?

我想添加一个 | 每个列表项前有两个空格。但是,由于某种原因,它会打印单词 nbsp 而不是空格。有任何想法吗?

回答by agacode

This could be the answer you are looking for :

这可能是您正在寻找的答案:

content: "|##代码##a0##代码##a0";

回答by NibblyPig

Fixed it by copying and pasting the non-breaking space from character map into my code editor.

通过将字符映射中的不间断空格复制并粘贴到我的代码编辑器中来修复它。