Why is this an issue?

CSS specifications define a fixed set of functions, such as linear-gradient(), translate(), or calc(). Browsers do not recognize any other function name, so a declaration that calls an unknown function is invalid and the browser discards the whole declaration. The intended style never applies, and the element keeps the value from an earlier declaration, or its inherited or initial value.

An unknown function is usually a typo, a misremembered name, or a function from a preprocessor or build tool that was left in a plain CSS file. This rule raises an issue on the name of each function that no CSS specification defines. Replace it with the intended CSS function.

This rule applies only to plain CSS, including <style> blocks in HTML files and Vue single-file components. It does not raise issues in SCSS, Sass, or Less files, or in <style> blocks written in those languages.

Code examples

Noncompliant code example

.banner {
  background: linaer-gradient(to right, white, gray); /* Noncompliant: misspelled function */
  transform: translateX(10px) rotation(45deg); /* Noncompliant: "rotation" is not a CSS function */
}

Compliant solution

.banner {
  background: linear-gradient(to right, white, gray);
  transform: translateX(10px) rotate(45deg);
}

A preprocessor function has no meaning in a plain CSS file. Write the resulting value instead:

Noncompliant code example

.button:hover {
  background-color: darken(#3366ff, 10%); /* Noncompliant: Sass function in a CSS file */
}

Compliant solution

.button:hover {
  background-color: #0040ff;
}

Exceptions

This rule does not raise an issue for:

None of the following declarations raise an issue:

.card {
  padding: --fluid(1rem, 2rem);
  color: theme('colors.gray.400');
  --shadow: elevation(2);
  filter: alpha(opacity=50);
  padding-top: constant(safe-area-inset-top);
  padding-top: env(safe-area-inset-top);
}

Resources

Documentation

Related rules