Skip to content

VBC-305: hardcoded-font-size

warning

Category: ux-dx
Analysis: Regex (line by line)
File types: .css, .scss
Scope: source code only, ignoring anything inside strings and comments
Tags: ux accessibility

What it reports

Hardcoded font size '{match}' detected at line {line}. Use relative units (rem/em) for better accessibility and user scale preferences.

Flagged

css
body { font-size: 14px; }

Not flagged

css
body { font-size: 1rem; }

Pattern

regex
font-size:\s*[0-9]+(px|pt|pc)

Released under the MIT License.