もっと詳しく

Avoiding <img> layout shifts: aspect-ratio vs width & height attributes

Avoiding <img> layout shifts: aspect-ratio vs width & height attributes

By default, an <img> takes up zero space until the browser loads enough of the image to know its dimensions: When you run the demo, you'll see the <figcaption> immediately. Then, after a few seconds, this paragraph and subsequent page content shifts downwards to make room for the image. This make…

はてなブックマーク - Avoiding <img> layout shifts: aspect-ratio vs width & height attributes はてなブックマークに追加