Do you *not* have height/width in an <img> tag?
22/12/2015 3:25 AM by
The <img> tag of HTML has 2 attributes that should not be used - "height" and "width". Any image resizing should be done via CSS. If the height / width ratio doesn't match that of original image, the image will be stretched.
<img src="images/codeauditor-logo.png" alt="Code Auditor logo" width="150" height="100" />
- Figure: Bad example - Stretched image caused by inline height/width ratio that doesn't match
<img src="images/codeauditor-logo.png" alt="Code Auditor logo" />
- Figure: Good example - Avoiding inline height/width ratio keeps the image as original
We have a program called
SSW Code Auditor to check for this rule.
Do you feel this rule needs an update?