Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

css

Rules: 8

css/feature

A style sheet uses features the browser targets lack

css/feature/unsupported · info · score 2.2 · site

Visitors on a browser from the declared targets get a broken or missing style where a feature is unsupported, unless a fallback declaration precedes it. Only judged when browser targets are set.

Fix

Give the feature a fallback declaration before it, or guard it with @supports (display: grid) { … }.

Off by default; a group that runs css turns it on.

References

For rule authors

Reads

  • resources.css

css/inline-feature

Inline CSS uses features the browser targets lack

css/inline-feature/unsupported · info · score 1.8 · page

Visitors on a browser from the declared targets get a broken or missing style where a feature is unsupported, unless a fallback declaration precedes it. Only judged when browser targets are set.

Fix

Give the feature a fallback declaration before it, or guard it with @supports (display: grid) { … }.

Off by default; a group that runs css turns it on.

References

For rule authors

Reads

  • css.features

css/inline-property

Inline CSS names unknown properties

css/inline-property/unknown · warning · score 4.2 · page

Browsers silently drop a declaration whose property they do not know, usually a typo, so the intended styling never applies.

Fix

Correct the property name, as in color: red for colr: red, or remove the declaration.

Off by default; a group that runs css turns it on.

References

For rule authors

Reads

  • css.messages

css/inline-style

Inline CSS has syntax errors

css/inline-style/invalid · warning · score 5.2 · page

Browsers drop the rule or block around a syntax error, so part of the page loses its styling for every visitor.

Fix

Close every block and string, and write selectors browsers accept, as in a::before { content: “” }.

Off by default; a group that runs css turns it on.

References

For rule authors

Reads

  • css.messages

css/inline-value

Inline CSS carries invalid property values

css/inline-value/invalid · warning · score 4.0 · page

Browsers drop a declaration whose value breaks the property’s grammar, so the intended styling never applies.

Fix

Give the property a value its grammar accepts, as in margin: calc(-1 * var(–gap)) for margin: -var(–gap).

Off by default; a group that runs css turns it on.

References

For rule authors

Reads

  • css.messages

css/property

A style sheet names unknown properties

css/property/unknown · warning · score 4.6 · site

Browsers silently drop a declaration whose property they do not know, usually a typo, so the intended styling never applies.

Fix

Correct the property name, as in color: red for colr: red, or remove the declaration.

Off by default; a group that runs css turns it on.

References

For rule authors

Reads

  • resources.css

css/stylesheet

A style sheet has syntax errors

css/stylesheet/invalid · warning · score 5.6 · site

Browsers drop the rule or block around a syntax error, so part of the page loses its styling for every visitor.

Fix

Close every block and string, and write selectors browsers accept, as in a::before { content: “” }.

Off by default; a group that runs css turns it on.

References

For rule authors

Reads

  • resources.css

css/value

A style sheet carries invalid property values

css/value/invalid · warning · score 4.4 · site

Browsers drop a declaration whose value breaks the property’s grammar, so the intended styling never applies.

Fix

Give the property a value its grammar accepts, as in margin: calc(-1 * var(–gap)) for margin: -var(–gap).

Off by default; a group that runs css turns it on.

References

For rule authors

Reads

  • resources.css