<img src="image.jpg" width="20px" height"20px">
Is the load time of the above equal to :
<img src="image.jpg">
I'm just curious about it as we know the smaller the image, the faster the load time
No, it doesn't speed up page load. But, it does prevent the 'effect' of the page building itself and breaking/fixing the layout as images are loaded. Putting the image dimensions in tells the browser to reserve the place where the image is going. In this way, on page load the layout should be fixed and the images will pop into place when loaded.
Having said this, in theory, adding the 'extra' markup for width/height should actually slow the page down as your code is slightly bigger than before. It's got to be a tiny, tiny amount though in the grand scheme of things...
No, setting width and height attributes only affects how the browser will render the image. The source file image.jpg remains the same size and still has to be downloaded in its entirety.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With