org.sonar.l10n.web.rules.Web.ImgWithoutAltCheck.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonar-web-plugin Show documentation
Show all versions of sonar-web-plugin Show documentation
Enables scanning of HTML, and JSP/JSF files.
The newest version!
The alt
attribute provides a textual alternative to an image.
It is used whenever the actual image cannot be rendered.
Common reasons for that include:
- The image can no longer be found
- Visually impaired users using a screen reader software
- Images loading is disabled, to reduce data consumption on mobile phones
Empty alt
attributes are not allowed, since purely decorative images should be specified using CSS, not using the img
tag.
Noncompliant Code Example
<img src="foo.png" /> <!-- Noncompliant -->
<img src="foo.png" alt="" /> <!-- Noncompliant -->
<input type="image" src="bar.png" /> <!-- Noncompliant -->
Compliant Solution
<img src="foo.png" alt="Some textual description of foo.png" />
<input type="image" src="bar.png" alt="Textual description of bar.png" />
© 2015 - 2024 Weber Informatics LLC | Privacy Policy