# Description

The counter() function is used to refer to the value of a counter (see `counter-increment` and `counter-reset properties`).

This function has the form:

    counter(identifier)

    or

    counter(identifier,
      list-style-type)

Note: In CSS 2.1, the value of a counter can only be referred to from the `content` CSS property.

# Arguments

Name | Description
--- | ---
identifier | Specifies the URL to represent. The URL can be quoted with either two single quote (') or double quote (") characters
list-style-type | (optional) Specifies the type. Default = decimal

# Examples

This example shows how to add a counter to the beginning of each `h1` element:

    body {
      /* Set counter to 0 */
      counter-reset: section;
    }

    h1:before {
      /* Increment the counter */
      counter-increment: section;

      /* Display the counter */
      content: "Section "
        counter(section) ": ";
    }

# Browser Support

Firefox | IE | Chrome | Opera | Safari

# Miscellaneous Information

Defined In: | CSS2.1