如何自动添加& raquo; (»)到< li>使用CSS的元素? [英] How to automatically add » (») to <li> elements using CSS?

查看:291
本文介绍了如何自动添加& raquo; (»)到< li>使用CSS的元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在每个 li 的左侧自动添加HTML字符& (»)元素。



最佳实践是什么?



我希望HTML成为:

 < ul> 
< li>项目1< / li>
< li>项目2< / li>
< li>项目3< / li>
< / ul>

它应该显示:

 »项目1 
»项目2
»项目3


解决方案

我发现上述答案对我不起作用,但以下内容对我有用:

  li:before {
content: \00BB;
}

此代码使用& raquo的十六进制代码代替。



可以在此处找到一个不错的十六进制转换器。 / p>

希望这可以帮助某人:)


I want to automatically add the HTML character &raquo; (») to the left of each li element.

What would be the best practise?

I want the HTML to be:

<ul>
  <li>item 1</li>
  <li>item 2</li>
  <li>item 3</li>
</ul>

And it should display:

» item 1
» item 2
» item 3

解决方案

I found the above answer didn't work for me, but the following does:

li:before{
   content: "\00BB";
}

This uses the hexadecimal code for &raquo instead.

A nice hexadecimal converter can be found here.

Hope this helps someone :)

这篇关于如何自动添加&amp; raquo; (»)到&lt; li&gt;使用CSS的元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆