prefix

This article needs a technical review. How you can help.

Summary

The prefix descriptor of the @counter-style rule allows authors to specify a symbol that will be prepended to the marker representation. If no value is specified, the default value will be the empty string.

Related at-rule@counter-style
Initial valuethe empty string
Mediaall
Computed valueas specified
Canonical orderthe unique non-ambiguous order defined by the formal grammar

Syntax

/* <symbol> values */
prefix: "»";
prefix: "Page";

Values

<symbol>
Specifies a <symbol> that is prepended to the marker representation.

Formal syntax

<symbol>

where
<symbol> = <string> | <image> | <ident>

Example

HTML Content

<ul class="index">
  <li>The Boy Who Lived</li>
  <li>The Vanishing Glass</li>
  <li>The Letters from No One</li>
  <li>The Keeper of the Keys</li>
  <li>Diagon Alley</li>
</ul>

CSS Content

@counter-style chapters {
  system: numeric;
  symbols: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9";
  prefix: 'Chapter ';
}

.index {
  list-style: chapters;
}

Result

Specifications

Specification Status Comment
CSS Counter Styles Level 3
The definition of 'prefix' in that specification.
Candidate Recommendation Initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support No support 33 (33) No support No support No support
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support No support 33 (33) No support No support No support

See also

Document Tags and Contributors

 Contributors to this page: duncanmcdonald, Sebastianz, hbloomer, jsx
 Last updated by: duncanmcdonald,