在CSS中,我们可以通过list-style属性来给文本添加项目符号。这个属性有三个子属性,分别是list-style-type、list-style-image和list-style-position,其中list-style-type是必须的,用来指定项目符号的类型。
我们可以为每个项目设置不同的符号类型。以下是一些常见的符号类型:
1. disc:实心圆点
2. circle:空心圆点
3. square:实心方块
4. decimal:数字
5. decimal-leading-zero:前导零的数字
6. lower-alpha:小写字母
7. upper-alpha:大写字母
8. lower-roman:小写罗马数字
9. upper-roman:大写罗马数字
例子:
<br>
p { list-style-type: disc; } /* 添加实心圆点 */<br>
<br>
p { list-style-image: url('images/bullet.gif'); } /* 添加图片作为符号 */<br>
<br>
p { list-style-position: inside; } /* 使项目符号位于文本内部 */<br>