Search code examples
stylelint

Stylelint: background-size after background-position in background shortcut rule


According to MDN:

The <bg-size> value may only be included immediately after <position>, separated with the '/' character, like this: "center/80%".

Is there any way to check this rule?


Solution

  • You wish to check the validity of your CSS code against the specifications, which is best done with a validator like CSSTree.

    You can use the stylelint-csstree-validator stylelint plugin to run this validator within stylelint.

    (You can test the validator online and it will flag a misformed background value, including a misplaced <bg-size>.)