How to scale HTML img with CSS?

Spread the love

Sometimes, we want to scale HTML img with CSS.

In this article, we’ll look at how to scale HTML img with CSS.

How to scale HTML img with CSS?

To scale HTML img with CSS, we set the width or height of the img element.

For instance, we write

img {
  width: 500px;
  height: auto;
}

to set the width of the img element to 500px.

And we set it height to auto so that the height is proportional to the width.

Conclusion

To scale HTML img with CSS, we set the width or height of the img element.

Leave a Reply

Your email address will not be published.