Unicode字符为CSS中列表项的项目符号 [英] Unicode character as bullet for list-item in CSS

查看:189
本文介绍了Unicode字符为CSS中列表项的项目符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用星号(★)作为列表项的项目符号。

I need to use, for example, the star-symbol(★) as the bullet for a list-item.

我已经阅读了 CSS3模块:列表,说明如何将自定义文本用作项目符号,但不是为我工作。我认为,浏览器根本不支持 :: marker 伪元素。

I have read the CSS3 module: Lists, that describes, how to use custom text as bullets, but it's not working for me. I think, the browsers simply don't support the ::marker pseudo element.

我如何做,不使用图片?

How can I do it, without using images?

推荐答案

EDIT

我可能不会建议使用图片了。我会坚持使用Unicode字符的方法,像这样:

I probably wouldn't recommend using images anymore. I'd stick to the approach of using a Unicode character, like this:

li:before {
  content: "\2605";
}

旧答案

我可能会去图片背景,他们更有效率和跨浏览器友好。

I'd probably go for an image background, they're much more efficient and cross-browser-friendly.

这里有一个例子:

<style type="text/css">
  ul {list-style:none;} /* you should use a css reset too... ;) */
  ul li {background:url(images/icon_star.gif) no-repeat 0 5px;}
</style>

<ul>
  <li>List Item 1</li>
  <li>List Item 2</li>
  <li>List Item 3</li>
</ul>

这篇关于Unicode字符为CSS中列表项的项目符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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