Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Functions

symbols() and other rare CSS functions

An overview of rarely used CSS functions such as symbols(), element(), paint(), cross-fade() and target-counter(), and which ones you can use in browsers.

Most CSS functions, like calc() or rgb(), work everywhere. A handful of others are defined in specifications but have little or no browser support, or exist only for print. This page is a map of those functions so you can recognize them and know when to stay away.

The short rule: do not build a page around any function on this list without testing it in the browsers you target. Where support is partial, guard the code with @supports and provide a normal fallback.

CSS
ul {
  list-style-type: disc;
}

@supports (list-style-type: symbols(cyclic "*")) {
  ul {
    list-style-type: symbols(cyclic "*" "+");
  }
}

Try it

Detecting symbols() support

The message changes depending on what your browser understands. That is the pattern to use for every function below.

Syntax

There is no single syntax. Each function has its own grammar:

CSS
list-style-type: symbols(cyclic "*" "+");
background: element(#preview);
background-image: paint(my-pattern);
background-image: cross-fade(url(a.png) 50%, url(b.png));
content: target-counter(attr(href url), page);

Values

Syntax and arguments Description
symbols(<type>? <symbol>+) Defines an anonymous counter style inline for list-style-type or counter functions. Type is cyclic, numeric, alphabetic, symbolic or fixed; the default is symbolic. A shortcut for @counter-style when you need only a few symbols. Support is limited, so check a compatibility table.
element(#id) Uses a live rendering of another element as an image, for example as a background. It has been available in Firefox with a -moz- prefix for many years but is not part of other browsers.
paint(name) Calls a paint worklet from the CSS Paint API (Houdini) to draw an image with JavaScript. Supported in Chromium-based browsers only, and the worklet must be registered first.
cross-fade(image percentage, image) Blends two images. Browsers have shipped it with a vendor prefix or not at all; for transitions between pages, use view transitions instead.
target-counter(), target-counters(), target-text() Print features that read a counter or text from the target of a link, used for "see page 12" style cross-references. They work in print engines such as PDF generators, not in browsers.
leader() Draws dot leaders between a title and a page number in a table of contents. Print engines only.
running() Together with element() it moves content into page margins in paged media. Print engines only.

Usage notes

  • symbols() versus @counter-style. @counter-style is a full at-rule with system, symbols, suffix and more. symbols() is the same idea in one line, with fewer options. If you need a custom list marker today, prefer ::marker with content, which is supported widely.
  • Unsupported functions invalidate the declaration. The whole declaration is dropped, so an earlier declaration (your fallback) applies. Declare the fallback first.
  • Do not detect by user agent. Use @supports with a real value of the function, as in the example above.
  • Print-only functions. If you generate PDFs with a print engine, consult its documentation; browsers' own print dialogs ignore these functions.
  • Houdini is optional enhancement. If you use paint(), make the unpainted page look acceptable.
  • Accessibility. None of these functions should carry content a reader needs; they decorate or lay out content.

Browser support

Mixed and mostly poor: symbols() has limited support, element() works only in Firefox with a prefix, paint() only in Chromium-based browsers, and the print functions in no mainstream browser. Check a compatibility table for the one you want.