Home / Software / Tips and Tricks / How to set maximum width or height for an image?

How to set maximum width or height for an image?

Updated:  01/15/2013 10:01 AM
Author:  Shiju Mathews

Status:    Resolved.


hen dealing with images in browser it is possible to set the height or width of the image using CSS or <img attributes. Bur the issue is that if the image size is lesser that the specified attribute size the image looks blurry or weird. One way to eliminate this is by applying the attributes only if the size is bigger.

By using the following CSS it is possible to apply the solution for all browsers.



Then apply the style to the image