跳到主要内容

列表与计数器

list-style 简写如何使用?​

  • list-style: 设置列表标号样式;
  • 成分属性: list-style-image、list-style-position、list-style-type;
  • 顺序不固定;
.two {
list-style: square inside;
}

list-style-type 有哪些取值?​

ol.normal {
list-style-type: none; /* 无标号 */
list-style-type: disc; /* 实心圆 */
list-style-type: circle; /* 空心圆 */
list-style-type: square; /* 实心方块 */
list-style-type: decimal; /* 十进制数字, 起始为 1 */
}
  • 字符串类型: 也可用自定义字符串作为标号;

list-style-position 如何控制标号位置?​

ol.normal {
list-style-position: inside; /* 标号在内容里 */
list-style-position: outside; /* 标号在内容外, 默认 */
}

list-style-image 如何使用?​

ol.normal {
list-style-image: none; /* 无图片, 回退到 list-style-type */
}
  • image 类型: 用 url() 指定标号图片;