Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is setting image dimensions via div img class the same as img class

Tags:

html

css

image

Trying to speed up my site and i run into the specify image dimensions to avoid reflow and repaints.

If i have images in divs with <div class="class"> .class img {height: xxxpx; width: xxxpx;}

Wouldn't that be the same as setting dimensions within <img class="class"> .class {height: xxxpx; width: xxxpx;}?

Just wondering if it works the same way as im getting the specify image dimensions warning in gtmetrix.

like image 779
Techagesite Avatar asked Oct 31 '22 01:10

Techagesite


1 Answers

Yes, it is the same. And, you can ignore the warning from gtmetrix.

http://gtmetrix.com/specify-image-dimensions.html

Page Speed currently only detects image dimensions that are specified via the image attributes. If you are specifying the dimensions via CSS, then you can safely ignore this recommendation.

like image 136
Bitwise Creative Avatar answered Nov 02 '22 22:11

Bitwise Creative