Quantcast
Channel: is it possible to decide height and width of a image? - Stack Overflow
Viewing all articles
Browse latest Browse all 6

Answer by Chaoix for is it possible to decide height and width of a image?

$
0
0

Ideally you should never rely on this for your final optimized website, but you can use CSS 2's max-height and max-width to scale down an image and maintain the images aspect ratio. I have used this as a fail safe for php projects in the past when displaying user content. For example:

<style type="text/css">.scaledimg {max-height: 200px;max-width: 200px;}</style><img class="scaledimg" src="imagesourcehere" />

Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>