org.sonar.l10n.web.rules.Web.ImgWithoutWidthOrHeightCheck.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
Analyze HTML (also within PHP/Ruby/etc. templates) and JSP/JSF code.
The newest version!
If the width
and height
attributes are set, the space required for the image is reserved immediately by the browser, even before it actually starts to load the image.
Without those attributes, the page layout constantly changes as images are loaded until they are all loaded, which can disorient users.
Noncompliant Code Example
<img src="logo.png" alt="My Company" /> <!-- Non-Compliant -->
Compliant Solution
<img src="logo.png" alt="My Company" width="100" height="50" /> <!-- Compliant -->
© 2015 - 2025 Weber Informatics LLC | Privacy Policy