== Why is this an issue?

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

[source,html]
----
<img src="logo.png" alt="My Company" />                           <!-- Non-Compliant -->
----


=== Compliant solution

[source,html]
----
<img src="logo.png" alt="My Company" width="100" height="50" />   <!-- Compliant -->
----



ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Add both a 'width' and a 'height' attribute to this image.


'''
== Comments And Links
(visible only on this page)

=== on 26 Jun 2013, 15:13:12 Dinesh Bolkensteyn wrote:
Let's also apply to <input type="image" /> tags

=== on 8 Jul 2013, 18:18:55 Freddy Mallet wrote:
Is implemented by \http://jira.codehaus.org/browse/SONARPLUGINS-3001

=== on 30 Nov 2018, 11:21:44 Nicolas Harraudeau wrote:
Reverting the rule name to "Image tags should have "width" and "height" attributes" (removing the requirement for buttons) as this rule's implementation does not check buttons and there has been no request or complains from community.


Note also that this rule is not enabled on Peach nor on Next, and it is not part of Sonar-Way. Thus the value of this rule seems quite dubious to me. Especially as it is quite common to define the width and height of images in CSS files.


\[~alexandre.gigleux] Shouldn't we deprecate such a rule?

endif::env-github,rspecator-view[]
