list-style

list-style CSS 属性是一个简写对属性集合,包括list-style-type, list-style-image, 和 list-style-position

概要

CSS list-style 属性是设置list-style-type, list-style-imagelist-style-position 的简写属性。

初始值as each of the properties of the shorthand:
适用元素list items
是否是继承属性yes
计算值as each of the properties of the shorthand:
Animation typeas each of the properties of the shorthand:

语法

Formal syntax: 
list-style = 
<'list-style-position'> ||
<'list-style-image'> ||
<'list-style-type'>

<list-style-position> =
inside |
outside

<list-style-image> =
<image> |
none

<list-style-type> =
<counter-style> |
<string> |
none

<image> =
<url> |
<gradient>

<counter-style> =
<counter-style-name> |
<symbols()>

<url> =
<url()> |
<src()>

<symbols()> =
symbols( <symbols-type>? [ <string> | <image> ]+ )

<url()> =
url( <string> <url-modifier>* ) |
<url-token>

<src()> =
src( <string> <url-modifier>* )

<symbols-type> =
cyclic |
numeric |
alphabetic |
symbolic |
fixed

以任何顺序接受一个,二个或者三个关键词

<'list-style-type'>

参看 list-style-type

<'list-style-image'>

参看 list-style-image

<'list-style-position'>

参看 list-style-position

示例

HTML

html
List 1
<ul class="one">
  <li>List Item1</li>
  <li>List Item2</li>
  <li>List Item3</li>
</ul>
List 2
<ul class="two">
  <li>List Item A</li>
  <li>List Item B</li>
  <li>List Item C</li>
</ul>

CSS

css
.one {
  list-style: circle;
}

.two {
  list-style: square inside;
}

Result

规范

Specification
CSS Lists and Counters Module Level 3
# list-style-property

浏览器兼容性

BCD tables only load in the browser

另参见