Set width and height on img tags

 It is best to have 'width' and 'height' attributes on 'img' tags even if they are 'responsive' and can change their size to fit the layout.


I wrongly removed the 'width' and 'height' from my 'img' tags when I made them 'responsive' by adding 'max-width: 100%' and 'height: auto' in my CSS.


The browser can calculate the size needed for the image early on from the ratio of the 'width' and 'height' in the HTML before the image is downloaded.


It seems quite complicated when I read about this.


There are more tips at:  bbingo.xyz/t


Comments

Popular posts from this blog

Steve Jobs quotes

Dark mode using 'invert' does not work on Firefox

Free quotes