Skip to content

attr-case

Reports an attribute name that is not in lowercase (CLASS="a"). Everything inside <svg> and <math> keeps its case and is not reported.

HTML reads attribute names without regard to case, so the capitals change nothing for the browser. They only make one file spell the same name two ways, which breaks searches and makes the markup look inconsistent.

To fix, write the name in lowercase.

Reported
...
<html lang="en">
<head><title>x</title></head>
<body>
<P CLASS="a" id = "b" title='c' data-x=d>x</P>
...
<p style="display: none">ok</p>
...
angular:
lint:
rules:
attr-case: warn # off (default), warn, error
html:
lint:
rules:
attr-case: warn # off (default), warn, error
svelte:
lint:
rules:
attr-case: warn # off (default), warn, error
vue:
lint:
rules:
attr-case: warn # off (default), warn, error

Enabled by the presets: html/html-validate-recommended, html/htmlhint.

Suppress one line with sudsy-disable-next-line attr-case in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
html-validate attr-case partial lowercase only, without the style and ignoreForeign options
htmlhint attr-lowercase full