Skip to content

element-case

Reports an element name that is not in lowercase, on the name of a start or end tag (<DIV>). Everything inside <svg> and <math> keeps its case and is not reported, and so are .vue, .svelte and *.component.html files, where component names are capitalised.

HTML reads element names without regard to case, so capitals only make the same element appear in two spellings. In component files a capital also tells a component from an element, so a mixed use hides which one it is.

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:
element-case: warn # off (default), warn, error
html:
lint:
rules:
element-case: warn # off (default), warn, error
svelte:
lint:
rules:
element-case: warn # off (default), warn, error
vue:
lint:
rules:
element-case: warn # off (default), warn, error

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

Suppress one line with sudsy-disable-next-line element-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-eslint lowercase partial the case of attribute names is attr-case
html-validate element-case partial lowercase only, without the style and ignoreForeign options
htmlhint tagname-lowercase full