• Hello! Why is there no width and height of the image in HTML? How to show it? I need it for lazy load.
    Gtmetrix:
    PageSpeed: Specify image dimensions
    Overview
    Specifying a width and height for all images allows for faster rendering by eliminating the need for unnecessary reflows and repaints.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I am wondering the same. Thank you for posting this important question.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Images only have a width and height if you explicitly give them one by resizing them in the editor. You can do this by grabbing their handles at the center of the sides (looks like a blue dot), and then dragging them to give them a defined size.

    In WordPress, images are generally intended to be responsive. That is, instead of having a fixed size in pixels, they fill the available space that they are put into. So they’ll be as wide as the post, or if they’re in a column, as wide as the column.

    The image itself is stored in several different sizes, and the browser chooses which image to show based on the space available for it. A browser on a wide screen might show the biggest image, one on a phone might show a smaller one. These are the same image, just at different sizes and filesizes, so the browser chooses based on things it knows and the server doesn’t know.

    But if you resize an image manually, then it gets a fixed set of widths and heights to use. The browser still chooses, but now the image is constrained to the size and not the size of the space that it is in.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Width and height for img❓💡⚡’ is closed to new replies.