Performance tip: Setting image size in HTML instead of CSS

Source: https://developers.google.com/web/tools/lighthouse/audits/aspect-ratio

When possible, it's a good practice to specify image width and height in HTML, so that the browser can allocate space for the image, which prevents it from jumping around as the page loads. It's more optimal to specify width and height in HTML rather than CSS, because the browser allocates space before parsing the CSS. In practice this approach can be difficult if you're working with responsive images, because there's no way to specify width and height until you know the viewport dimensions.

Date: 2019-02-14 Thu 00:00

Author: Huy Tran

Created: 2019-04-22 Mon 14:40