Versions:
- SonarQube: 8.9.1 (build 44547)
- SonarScanner: 4.6.1.2450
Description:
A HTML user-experience rule was created, indicating that the image does not have height
or width
attributes even though I have them defined in a search_img
CSS class rule.
I believe this is false-positive.
Minimal code:
<html>
<!-- header content... -->
<body>
<style>
/* This is the CSS rule for the image */
.search_img {
height: 100%;
width: 1.5%;
}
</style>
<div>
<div style="padding-left: 5em; padding-bottom:2em;">
{% load static %}
<!-- The next line is where the issue pops up. -->
<img class="search_img" alt="Search" src="{% static "admin/search.svg" %}" />
<p style="color: rgb(51, 51, 102); display:inline; background-color: inherit;font-size: 2em;font-weight: bold;padding-left: 0.5em;">Customer Search</p>
</div>
</div>
<!-- other content... -->
</body>
</html>