Skip to content

alt-require

Alt of img must be present and alt of area[href] and input[type=image] must be set with a value.

Level: Warning

  • true: enable rule
  • false: disable rule

The following patterns are not considered rule violations

Section titled “The following patterns are not considered rule violations”
<img src="test.png" alt="test" />
<input type="image" alt="test" />
<area shape="circle" coords="180,139,14" href="test.html" alt="test" />

The following patterns are considered rule violations

Section titled “The following patterns are considered rule violations”
<img src="test.png" />
<input type="image" />
<area shape="circle" coords="180,139,14" href="test.html" />

The alt attribute is used to provide alternative text for images, which helps improve accessibility for users who cannot see the image. It also helps with SEO by providing context for the image.