[Solved – 4 Answers] Resize image proportionally with CSS

Is there a way to resize (scale down) images proportionally using ONLY CSS?

  • We can resize the image using JavaScript way, but just trying to see if this is possible with CSS.

To resize the image proportionally using CSS we tried following

responsive images code
img. Resize{
    width:540px; /* you can use % */
    height: auto;

This solution we can Control size and maintain proportion :

responsive background image code
#your-img {
    height: auto; 
    width: auto; 
    max-width: 300px; 
    max-height: 300px;

If it’s a background image, use background-size:contain.

Example css:

responsive images code

#your-div {
  background: url('image.jpg') no-repeat;

To scale an image by keeping its aspect ratio.

You can try the following,

responsive background image code

img {



  • This article provides some of the basic informations on responsive images , responsive image css , img responsive , img responsive css , make image responsive , responsive background image , background image responsive , responsive background image css , background image size , background image size css , html image size , html background image size , css background image stretch , img width , css background image size , image size html , background image width , how to make image responsive , image width and height , design background images , how to make background image responsive , stretch background image css , background image responsive css , background image height , image size in html , how to resize image in html , image height and width , images of scales , img src in css , background image html fit to screen , html background image size to fit , how to set image size in html , how to change width and height of image.
See also  [10 Solved Answer]How to vertically center text with CSS

About the author

Wikitechy Editor

Wikitechy Founder, Author, International Speaker, and Job Consultant. My role as the CEO of Wikitechy, I help businesses build their next generation digital platforms and help with their product innovation and growth strategy. I'm a frequent speaker at tech conferences and events.


Click here to post a comment