Html 自动添加&raqu; (?) 到 li's
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1155128/
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
Automatically add » (?) to li's
提问by Brad
I want to automatically add the HTML character »
(?) to the left of each li
element.
我想自动将 HTML 字符»
(?)添加到每个li
元素的左侧。
What would be the best practise?
最好的做法是什么?
I want the HTML to be:
我希望 HTML 是:
<ul>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ul>
And it should display:
它应该显示:
? item 1
? item 2
? item 3
回答by brendo
I found the above answer didn't work for me, but the following does:
我发现上面的答案对我不起作用,但以下内容适用:
li:before{
content: "li { background: url("raquo.gif") no-repeat left center; }
BB";
}
This uses the hexadecimal code for » instead.
这改为使用 » 的十六进制代码。
A nice hexadecimal converter can be found here.
一个不错的十六进制转换器可以在这里找到。
Hope this helps someone :)
希望这对某人有所帮助:)
回答by Brad
If you don't want the arrows to appear as content then why not go for a css background?
如果您不希望箭头显示为内容,那么为什么不使用 css 背景呢?
##代码##