Link to home
Start Free TrialLog in
Avatar of D F
D FFlag for United States of America

asked on

fix image max width and/or height?

I know you can set a image's height and/or width but can you set a max height and width so We a person puts a image my site wont allow it to expand a certain size. I dont' want to set the size because if their image is smaller then my set size I don't want it to stretch?

 <img src="" alt="" (max)width="150"  (max)height="150" border="" />
Avatar of Chris Ashcraft
Chris Ashcraft
Flag of United States of America image

This isn't possible with the IMG tag, but there are a few ways it can be done... you can put them in a div any apply max-width/height and overflow properties to the div's CSS style, you can resize them at the server on upload, or you can use javascript to resize them on the client side...

See here... http://www.webdeveloper.com/forum/showthread.php?t=118246
put your img tag with width=100% in to the div of your ficed size this will solve your problem.

Regards,
nishant
ASKER CERTIFIED SOLUTION
Avatar of s8web
s8web

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of D F

ASKER

Perfect thank you