Thursday, July 13, 2023

Fluid image

 <img src="nature.jpg" alt="Nature" class="responsive">

.responsive {
  width: 100%;
  height: auto;
}

If you want the image to scale both up and down on responsiveness, set the CSS width property to 100% and height to auto:


If you want an image to scale down if it has to, but never scale up to be larger than its original size, use max-width: 100%:

.responsive {
  max-width: 100%;
  height: auto;
}

0 comments:

Post a Comment