Skip to main content
Active reading.
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

Make it simple!

Give the container a fixed height and then for the img tag inside it, set width and max-height.

<div style="height: 250px">
     <img src="..." alt=" " style="width: 100%;max-height: 100%" />
</div>

DifferenceThe difference is that you set the width to be 100%, not the max-width.

Make it simple!

Give the container a fixed height and then for the img tag inside it set width and max-height.

<div style="height: 250px">
     <img src="..." alt=" " style="width: 100%;max-height: 100%" />
</div>

Difference is that you set the width to be 100% not the max-width.

Make it simple!

Give the container a fixed height and then for the img tag inside it, set width and max-height.

<div style="height: 250px">
     <img src="..." alt=" " style="width: 100%;max-height: 100%" />
</div>

The difference is that you set the width to be 100%, not the max-width.

deleted 39 characters in body
Source Link
Uwe Keim
  • 40.9k
  • 61
  • 193
  • 309

makeMake it simple simple!
Give

Give the Containercontainer a fixed heightheight and then for the imgimg tag inside it set widthwidth and max-height !max-height.

<div style="height: 250px">
     <img src="..." alt=" " style="width: 100%;max-height: 100%" />
</div>

differenceDifference is that you set the widthwidth to be 100% !100% not the max-width ! Try it ;)max-width.

make it simple !
Give the Container fixed height and then for the img tag inside it set width and max-height !

<div style="height: 250px">
     <img src="..." alt=" " style="width: 100%;max-height: 100%" />
</div>

difference is that you set the width to be 100% ! not the max-width ! Try it ;)

Make it simple!

Give the container a fixed height and then for the img tag inside it set width and max-height.

<div style="height: 250px">
     <img src="..." alt=" " style="width: 100%;max-height: 100%" />
</div>

Difference is that you set the width to be 100% not the max-width.

improved formatting :)
Source Link

make it simple !
Give the Container fixed height and widthfixed height and max-heightthen for the imgimg tag inside it set width and max-height !

<div style="height: 250px">
     <img src="..." alt=" " style="width: 100%;max-height: 100%" />
</div>

difference is that you set the widthwidth to be 100%100% ! not the max-widthmax-width ! Try it ;)

make it simple !
Give the Container fixed height and width and max-height for the img inside it!

<div style="height: 250px">
     <img src="..." alt=" " style="width: 100%;max-height: 100%" />
</div>

difference is that you set the width to be 100% ! not the max-width ! Try it ;)

make it simple !
Give the Container fixed height and then for the img tag inside it set width and max-height !

<div style="height: 250px">
     <img src="..." alt=" " style="width: 100%;max-height: 100%" />
</div>

difference is that you set the width to be 100% ! not the max-width ! Try it ;)

Source Link
Loading