设置一些不同的列表样式:
ul.a {list-style-type: circle;}
ul.b {list-style-type: square;}
ol.c {list-style-type: upper-roman;}
ol.d {list-style-type: lower-alpha;}
亲自试一试 »
下面有更多 "亲自试一试" 示例。
这个list-style-type
指定列表中列表项标记的类型。
表中的数字指定完全支持该属性的第一个浏览器版本。
Property | |||||
---|---|---|---|---|---|
list-style-type | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
笔记:Edge 18 和 Opera 12 及更早版本不支持以下值:cjk-ideograph、hebrew、hiragana、hiragana-iroha、katakana 和 katakana-iroha。
list-style-type:
value;
Value | Description | Demo |
---|---|---|
disc | Default value. The marker is a filled circle | Demo ❯ |
armenian | The marker is traditional Armenian numbering | Demo ❯ |
circle | The marker is a circle | Demo ❯ |
cjk-ideographic | The marker is plain ideographic numbers | Demo ❯ |
decimal | The marker is a number | Demo ❯ |
decimal-leading-zero | The marker is a number with leading zeros (01, 02, 03, etc.) | Demo ❯ |
georgian | The marker is traditional Georgian numbering | Demo ❯ |
hebrew | The marker is traditional Hebrew numbering | Demo ❯ |
hiragana | The marker is traditional Hiragana numbering | Demo ❯ |
hiragana-iroha | The marker is traditional Hiragana iroha numbering | Demo ❯ |
katakana | The marker is traditional Katakana numbering | Demo ❯ |
katakana-iroha | The marker is traditional Katakana iroha numbering | Demo ❯ |
lower-alpha | The marker is lower-alpha (a, b, c, d, e, etc.) | Demo ❯ |
lower-greek | The marker is lower-greek | Demo ❯ |
lower-latin | The marker is lower-latin (a, b, c, d, e, etc.) | Demo ❯ |
lower-roman | The marker is lower-roman (i, ii, iii, iv, v, etc.) | Demo ❯ |
none | No marker is shown | Demo ❯ |
square | The marker is a square | Demo ❯ |
upper-alpha | The marker is upper-alpha (A, B, C, D, E, etc.) | Demo ❯ |
upper-greek | The marker is upper-greek | Demo ❯ |
upper-latin | The marker is upper-latin (A, B, C, D, E, etc.) | Demo ❯ |
upper-roman | The marker is upper-roman (I, II, III, IV, V, etc.) | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
此示例演示了所有不同的列表项标记:
ul.a {list-style-type: circle;}
ul.b {list-style-type: disc;}
ul.c {list-style-type: square;}
ol.d {list-style-type: armenian;}
ol.e {list-style-type: cjk-ideographic;}
ol.f {list-style-type: decimal;}
ol.g {list-style-type: decimal-leading-zero;}
ol.h {list-style-type: georgian;}
ol.i {list-style-type: hebrew;}
ol.j {list-style-type: hiragana;}
ol.k {list-style-type: hiragana-iroha;}
ol.l {list-style-type: katakana;}
ol.m {list-style-type: katakana-iroha;}
ol.n {list-style-type: lower-alpha;}
ol.o {list-style-type: lower-greek;}
ol.p {list-style-type: lower-latin;}
ol.q {list-style-type: lower-roman;}
ol.r {list-style-type: upper-alpha;}
ol.s {list-style-type: upper-greek;}
ol.t {list-style-type: upper-latin;}
ol.u {list-style-type: upper-roman;}
ol.v {list-style-type: none;}
ol.w {list-style-type: inherit;}
亲自试一试 »
如何通过删除默认项目符号并添加看起来像项目符号 (•) 的 HTML 实体来为 <ul> 或 <ol> 添加项目符号颜色:
ul {
list-style: none; /* Remove list bullets */
padding: 0;
margin: 0;
}
li {
padding-left: 16px;
}
li::before {
content: "•"; /* Insert content that looks like bullets */
padding-right: 8px;
color: blue; /* Or a color you prefer */
}
亲自试一试 »
CSS教程:CSS 列表
CSS 参考:列表样式属性
HTML DOM 参考:listStyleType 属性
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!