CSS中,列表前面那个点可以通过修改list-style-type属性来改变。
示例代码:
ul {
list-style-type: disc; /* 实心点 */
}
ol {
list-style-type: decimal; /* 数字 */
}
ul {
list-style-type: circle; /* 空心圆 */
}
ol {
list-style-type: lower-roman; /* 小写罗马数字 */
} 除了上述几种常见的list-style-type属性值,还有许多其他可选的值,包括:
square /* 正方形 */
upper-alpha /* 大写字母A、B、C... */
lower-alpha /* 小写字母a、b、c... */
upper-latin /* 大写字母A、B、C...(适用于语言环境:拉丁语) */
upper-greek /* 大写希腊字母Α、Β、Γ... */
lower-greek /* 小写希腊字母α、β、γ... */
lower-roman /* 小写罗马数字i、ii、iii... */
upper-roman /* 大写罗马数字I、II、III... */ 除此之外,我们还可以使用CSS伪元素:before来自定义列表标记。
示例代码:
ul li:before {
content: "•"; /* 使用Unicode实心点符号作为标记 */
margin-right: 0.5em; /* 标记和文字之间的间距 */
color: #ff0000; /* 标记颜色 */
font-weight: bold; /* 标记字体加粗 */
} 以上就是关于如何改变CSS列表前面那个点的几种方法。