Trakis

Trakis · Rules

Images without declared dimensions

Shown images without width and height attributes and without an inline style that sets their box (width and height, or aspect-ratio). The stylesheet is not read. Without a size the browser does not know how much space to keep, and the page jumps as images load: the shift Cumulative Layout Shift measures. web.dev’s advice is to always give images and video width and height, which modern browsers also use to keep the proportion when CSS resizes them.

WarningPERF-001 · Performance · checked on every page

Image width and height: why to declare them, and how they stay responsive

Updated 17 October 2026.

An image arrives after the text around it. If the page did not say how big it is, the browser keeps no room for it, draws the text, and then pushes everything down when the image lands: the jump that Cumulative Layout Shift measures. This check finds images whose size the HTML does not give.

What web.dev says (Optimize CLS, CLS):

  • Images and video with unknown dimensions are among the common causes of layout shifts.
  • Always give images and video width and height attributes, or reserve the space with CSS aspect-ratio.

The attributes do not fix the image’s size on screen. They give its proportion: modern browsers use them to keep the right amount of space while CSS makes the image as wide as its column.

<img src="/img/boots.jpg" width="1200" height="800" alt="…">

img { max-width: 100%; height: auto; }   /* fills the column, keeps 3:2 */

Where a design sizes images in CSS instead, an aspect-ratio on the box does the same work. What does not: height: auto alone, which waits for the image like no style at all.

Where the attributes go missing, nearly always in one place:

  • An image component or a theme that prints only src and alt.
  • A theme that strips the attributes so images resize, which height: auto makes unnecessary.
  • A lazy-loading script that writes the tag itself, or a rich-text editor that drops the size on paste.

The demo shop, as it is. Its product template gives the image its size:

<img src="/img/boots.svg" width="480" height="320">

It has no alt text, which is CONTENT-002, but its space is kept, and PageSpeed’s lab measured a layout shift of 0 on that page. trakis.io’s public pages have no images at all.

Check it yourself. Inspect an image in the browser’s developer tools: the <img> should carry width and height, or its box a size in CSS. The Performance panel marks each layout shift and the elements that moved.

How the audit decides.

  • It reads every <img> in the page’s HTML. One without both width and height counts, unless its inline style sets its box (a width and a height that are not auto, or an aspect-ratio) or it is not shown at all (hidden, an inline display: none).
  • Any is PERF-001, a warning, with the first images as evidence; pages from one template are one finding.
  • It cannot read the stylesheet, so an image sized there still counts, and the sentence says so: the page shifts unless the stylesheet sizes it. Until 17 October 2026 hidden and inline-sized images counted too, and the sentence promised a shift.
  • Whether the page really shifts is PERF-005, measured by PageSpeed.

Sources, read on 17 October 2026: web.dev, Optimize Cumulative Layout Shift · web.dev, Cumulative Layout Shift (CLS).

How common it is

In our study of 330 small sites, read from Common Crawl’s October 2026 archive (up to 100 pages a site), 90.0% of them had this problem on one page or more.

Where it usually comes from

Images inserted with only a src, themes that strip width and height to make images responsive, and lazy-loading scripts that replace the tag.

How to fix it

  • Give every <img> its width and height attributes — the image's real size in pixels. CSS can still make it responsive.
  • The browser then keeps the space while the image loads, and the page stops jumping.
pattern
<img src="…" width="800" height="600" style="max-width:100%;height:auto" alt="…">

Shown for an example shop at www.example.com. In a Trakis report the same fix comes with your own addresses and the list of your pages it applies to.

How to check it yourself

In the developer tools, inspect an image and check for width and height attributes on the <img> tag, or a size the stylesheet gives its box.

What it looks like in a report

Warning 14 images have no width and height, so the browser cannot keep their space before they arrive; unless the stylesheet sizes them, the page shifts as they load. · whole site

The theme prints images without dimensions; adding them in the image component fixes every page. (An example shop; the numbers are illustrative.)

How the audit counts it

PERF-001 is a warning in the performance category, and weighs moderately in that category’s score. When it appears on many pages built from the same template, the report shows it once, with the number of pages it covers — because one change in the template fixes all of them.

If the finding is deliberate on your site, it can be accepted as intentional in the report. It then leaves the list and the score, and comes back on its own if what it shows changes.

Other performance checks

Find it on your site

A free Trakis audit runs this check and the other 66 on your site, and tells you on how many pages each one sits. Or go back to all the rules.