How to make an image smaller in HTML?

To make an image smaller in HTML, you can use the “width” and “height” attributes with the values in pixels inside the <img> tag.

Following is the HTML code to make an image having a width of 200 pixels and a height of 80 pixels.


<img src="my_file.png" width="200" height="90"> 

However, you can also use CSS to make the image smaller. For CSS, it’s recommended to use “width” and “height” properties.


<img src="my_file.png" style="width: 200px; height: 90px;">
LambdaTest

Test your websites, web-apps, or mobile apps seamlessly with LambdaTest.

Start Free Testing
LambdaTest

Earn resume-worthy Selenium certifications that help you land a top job.

Learn More
LambdaTest

Test your web or mobile apps

Test orchestration and execution cloud of 3000+ browsers and OS

Support

24/7 support

Security

Enterprise grade security

Cloud

Fastest test execution cloud