Results 1 to 1 of 1
-
02-02-2012, 10:40 AM #1
- Join Date
- Apr 2008
- Location
- Boston, USA
- Posts
- 13,175
- Thanks
- 744
- Thanked 699 Times in 550 Posts
- Blog Entries
- 4
- Feedback Score
- 4 (100%)
Limiting Image Width With CSS If Width Greater then Maximum
Limiting Image Width With CSS If Width Greater then Maximum
Lets say you want a maximum width of an image to be 100 pixel. If an image has width more then 100 pixel then you want the width set to 100, if the width is less then or equal to 100 you want it as is.
Here is a css class that would do just that.
.image100 {max-width:100px;width
xpression(this.width > 100 ? 100: true);}
Now you can use the class on images you need to enforce this width restriction.
<img src="myimage.gif" class="image100" alt="" />Free Classified Ads & BUSINESS/PROFESSIONAL SOCIAL NETWORK
Similar Threads
-
width help
By slanluc in forum Graphics Design & Web DesignReplies: 0Last Post: 10-09-2011, 02:53 AM -
Fixed Width or Fluid Width?
By slanluc in forum BloggingReplies: 0Last Post: 09-03-2011, 03:13 AM -
Do you use MIN/MAX-WIDTH and MIN/MAX-HEIGHT ??
By connie_pankratz in forum HTML / DHTMLReplies: 5Last Post: 09-08-2009, 02:58 AM -
Do you still use MIN/MAX-WIDTH and MIN/MAX-HEIGHT
By sanjalee in forum Graphics Design & Web DesignReplies: 3Last Post: 07-23-2009, 03:16 AM -
Max Image Width
By manik in forum CSSReplies: 7Last Post: 02-10-2009, 12:50 AM


Reply With Quote

