CSS - list-style
The list-style
property is a shorthand property for setting list-style-type
, list-style-image
and list-style-position
.
Examples
HTML
HTML
Copy Code
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
Copy Code
.one { list-style: circle; } .two { list-style: square inside; }
Result
Syntax
CSS
Copy Code
/* type */ list-style: square; /* image */ list-style: url('../img/dino.png'); /* position */ list-style: inside; /* type | position */ list-style: georgian inside; /* type | image | position */ list-style: lower-roman url('../img/dino.png') outside; list-style: none; /* Global values */ list-style: inherit; list-style: initial; list-style: unset;
Values
Accepts one, two or three keywords in any order. If list-style-type
and list-style-image
are both set, then list-style-type
is used if the image is unavailable.
<'list-style-type'>
- See
list-style-type
<'list-style-image'>
- See
list-style-image
<'list-style-position'>
- See
list-style-position
Formal syntax
CSS
Copy Code
<a href="css/list-style-type" title="<counter-style> | <string> | none"><'list-style-type'></a> <a href="css/value_definition_syntax#double_bar" title="Double bar">||</a> <a href="css/list-style-position" title="inside | outside"><'list-style-position'></a> <a href="css/value_definition_syntax#double_bar" title="Double bar">||</a> <a href="css/list-style-image" title="<uri> | none"><'list-style-image'></a>
Description
The list-style
property is a shorthand property for setting list-style-type
, list-style-image
and list-style-position
.
Initial value | as each of the properties of the shorthand:
|
---|---|
Applies to | list items |
Inherited | yes |
Media | visual |
Computed value | as each of the properties of the shorthand:
|
Animatable | no |
Canonical order | order of appearance in the formal grammar of the values |
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 1.0 | 1.0 (1.7 or earlier) | 4.0 | 7.0 | 1.0 |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | 1.0 | 1.0 (1) | 6.0 | 6.0 | 1.0 |
See Also
Specifications
Specification | Status | Comment |
---|---|---|
CSS Lists and Counters Module Level 3 The definition of 'list-style' in that specification. |
Working Draft | No change |
CSS Level 2 (Revision 1) The definition of 'list-style' in that specification. |
Recommendation | Initial definition |
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/css/list-style