Categories
JavaScript Answers

How to resize image with JavaScript?

Spread the love

Sometimes, we want to resize image with JavaScript.

In this article, we’ll look at how to resize image with JavaScript.

How to resize image with JavaScript?

To resize image with JavaScript, we set the width and height properties.

For instance, we write

image.style.width = "50%";
image.style.height = "auto";

to set the style.width and style.height properties to set the width and height of the image.

Conclusion

To resize image with JavaScript, we set the width and height properties.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *