What is the more “correct” way to define <img>‘s width and height?
Will it be directory through the tag with its “width” and “height” attributes, or would it be better to do it via CSS img { width:...; height... } ?
What is the more correct way to define <img> ‘s width and height? Will
Share
In this case it is definitely the right way, there really is no wrong way, to specify the width and height on the image tag itself. Especially during the rendering phase of your site, having the dimensions specified there, will be a small performance improvement as the browser does not need to try and calculate the size of the images.
From the spec:
“Author requirements: The width and height attributes on img, iframe, embed, object, video, and, when their type attribute is in the Image Button state, input elements may be specified to give the dimensions of the visual content of the element”.