Skip to content
Justice Tech School

Image Width and Height

Set width and height so the browser reserves space and the page does not jump while loading. Use CSS max-width: 100% to make images flexible.

Example
<img alt="Teal box" width="160" height="80" src="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27160%27 height=%2780%27%3E%3Crect width=%27160%27 height=%2780%27 fill=%27%2314b8a6%27/%3E%3C/svg%3E">

Exercise

Set the width.

<img ="200" src="a.png" alt="">

Quiz Test

Why set width and height?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.