files/en-us/web/css/reference/at-rules/@counter-style/pad/index.md
The pad descriptor of the {{cssxref("@counter-style")}} at-rule is used to set a minimum length for marker representations.
pad: 3 "0";
pad: "+" 5;
The descriptor accepts the following two values, which are separated by a space and can be specified in any order:
{{cssxref("integer")}}
pad descriptor, this value is also known as the pad length.<integer> is not reached. In the case of the pad descriptor, this value is also known as the padding symbol.Use the pad descriptor when you need the marker representations to be of a minimum length. If a marker representation is shorter than the specified pad length, then the marker representation will be padded with the specified padding symbol. Marker representations longer than the pad length are displayed without any additional padding.
The pad descriptor takes an <integer> for the minimum marker length and a <symbol> for the padding. A common use case of the pad descriptor is when you need a list to start numbering from 01 and go through 02, 03, 04, and so on, instead of just 1, 2, 3, and 4. By specifying the pad descriptor as pad: 2 "0" in this case, the browser ensures to make the counter at least two characters long and adds a padding with 0 to reach the minimum two-character length where needed. Counters that are already two or more characters long in this example will be displayed normally, without padding.
{{cssinfo}}
{{csssyntax}}
This example extends the decimal {{cssxref("@counter-style/system","system")}} to create a counter that is at least three characters long, padding shorter counters with 0 to reach that minimum length. A {{cssxref("@counter-style/suffix", "suffix")}} descriptor has been added to make the output more legible.
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
<li value="40">Forty</li>
<li>Forty-one</li>
<li value="200">Two hundred</li>
<li value="3000">Three thousand</li>
<li>and so on</li>
</ul>
@counter-style pad-example {
system: extends decimal;
suffix: ": ";
pad: 3 "0";
}
ul {
list-style: pad-example;
}
{{ EmbedLiveSample('Padding a counter', '100', '200') }}
{{Specifications}}
{{Compat}}