Docs / Image / Add Width and Height Attributes

Add Width and Height Attributes

Adding width and height attributes to images will reduce Cumulative Layout Shift (CLS) caused by images.

Before:

<img src="https://example.com/wp-uploads/cat.png" />

After:

<img src="https://example.com/wp-uploads/cat.png" width="200" height="200" />

Compatibility

  • Width and height attributes can be added to images only on your server. It won't be added to external images.
  • If an image already has width and height attribute added, it will be skipped