CSS lists and counters
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
The CSS lists and counters module enables styling and positioning of list item bullets and manipulating their values with a combination of strings, counters, and other features.
A list item's marker, whether a bullet symbol or ordinal counter, is its defining feature. List items are not limited to {{HTMLElement("li")}} elements nested within {{HTMLElement("ol")}} or {{HTMLElement("ul")}} elements. Rather, list items are any element with display: list-item set.
This module defines CSS features to set and reset a list's counters, set which counter-styles or symbols to use as its markers, and position those markers. It also provides developers with the ability to create customized markers.
Reference
Properties
- {{cssxref("counter-increment")}}
- {{cssxref("counter-reset")}}
- {{cssxref("counter-set")}}
- {{cssxref("list-style-image")}}
- {{cssxref("list-style-type")}}
- {{cssxref("list-style-position")}}
- {{cssxref("list-style")}} shorthand
There is also a marker-side property, which is yet to be fully defined or implemented.
Pseudo-elements
- {{cssxref("::marker")}}
Functions
- {{cssxref("counter")}}
- {{cssxref("counters")}}
Data types
- [
<counter>](/en-US/docs/Web/CSS/Reference/Properties/content#counter) - [
<counter-name>](/en-US/docs/Web/CSS/Reference/Values/counter#counter-name) - [
<counter-style>](/en-US/docs/Web/CSS/Reference/Values/counter#counter-style)
Guides
- Consistent list indentation
- : Explains how to achieve consistent list indentation across different browsers.
- Using CSS Counters
- : Explains how to use the CSS counter properties to control list counters.
Related concepts
- CSS counter styles
- {{cssxref("@counter-style")}} at-rule
- [
<counter-style-name>](/en-US/docs/Web/CSS/Reference/At-rules/@counter-style#counter-style-name) data type - [
<symbol>](/en-US/docs/Web/CSS/Reference/At-rules/@counter-style/symbols#values) data type - {{cssxref("symbols()")}} function
- {{HTMLElement("ol")}}
start,reversed, andtypeattributes - {{HTMLElement("ul")}}
typeattribute - {{HTMLElement("li")}}
typeandvalueattributes
Specifications
{{Specifications}}
See also
- CSS counter styles module
- CSS pseudo-elements module
- CSS generated content module