Code Inspections in CSS
This topic lists all PhpStorm code inspections available in CSS.
You can toggle specific inspections or change their severity level on the Editor | Inspections page of settings Ctrl+Alt+S.
Probable bugs
Inspection | Description | Default Severity |
---|---|---|
Reports a multi-line selector. Most likely this means that several single-line selectors are actually intended but a comma is missing at the end of one or several lines. Example:
input /* comma has probably been forgotten */
.button {
margin: 1px;
}
| Warning | |
Verifies that the Generic font family names are: | Warning | |
Reports a non-integer length in pixels. Example: width: 3.14px | Weak warning |
Code quality tools
Inspection | Description | Default Severity |
---|---|---|
Reports a discrepancy detected by the Stylelint linter. The highlighting is based on the rule severity specified in the Stylelint configuration file for each individual rule. | ||
Reports a discrepancy detected by the W3C CSS Validator. |
Code style issues
Inspection | Description | Default Severity |
---|---|---|
Reports a missing semicolon at the end of a declaration. | ||
Reports a measure unit of a zero value where units are not required by the specification. Example: width: 0px | Warning |
Invalid elements
Inspection | Description | Default Severity |
---|---|---|
Reports an unknown CSS function or an incorrect function parameter. | Error | |
Reports an unknown CSS media feature or an incorrect media feature value. | Error | |
Reports an incorrect CSS property value. | Error | |
Reports an incorrect CSS pseudo-class pseudo-element. | Error | |
Reports a CSS type selector that matches an unknown HTML element. | Warning | |
Reports a misplaced According to the specification, | Warning | |
Reports a misplaced | Warning | |
Reports a negative value of a CSS property that is not expected to be less than zero, for example, object width or height. | Error | |
Reports an unknown CSS at-rule. | Error | |
Reports an unknown CSS property or a property used in a wrong context. Add the unknown property to the 'Custom CSS properties' list to skip validation. | Warning | |
Reports a CSS class reference in the 'composes' rule that cannot be resolved to any valid target. Example:
.className {/* ... */}
.otherClassName {
composes: className;
}
| Error | |
Reports an unresolved reference to a custom property among the arguments of the | Error | |
Reports an unresolved file reference, for example, an incorrect path in an | Error |
Other inspections
Inspection | Description | Default Severity |
---|---|---|
Reports an Suggests replacing a color function with an equivalent hexadecimal notation. Example: rgb(12, 15, 255) After the quick-fix is applied: #0c0fff . | ||
Reports an Suggests replacing such color value with an equivalent Example: #0c0fff After the quick-fix is applied: rgb(12, 15, 255) . | ||
Reports a duplicated CSS property within a ruleset. Respects shorthand properties. Example:
.foo {
margin-bottom: 1px;
margin-bottom: 1px; /* duplicates margin-bottom */
margin: 0; /* overrides margin-bottom */
}
| Warning | |
Reports a set of longhand properties. Suggests replacing a complete set of longhand CSS properties with an equivalent shorthand form. For example, 4 properties: Note that this inspection doesn't show up if the set of longhand properties is incomplete (e.g. only 3 | Weak warning | |
Reports a set of longhand CSS properties and suggests replacing an incomplete set of longhand CSS properties with a shorthand form, which is however not 100% equivalent in this case. For example, 2 properties: This inspection doesn't handle full sets of longhand properties (when switching to shorthand is 100% safe). For such cases see the 'Properties may be safely replaced with a shorthand' inspection instead. | No highlighting, only fix | |
Reports a CSS property that is not supported by the specified browsers. Based on the MDN Compatibility Data. | ||
Reports a CSS class or an element IDs that appears in selectors but is not used in HTML. Note that complete inspection results are available only when running it via Code | Inspect Code or Code | Analyze Code | Run Inspection by Name. Due to performance reasons, style sheet files are not inspected on the fly. | Warning |