PDA

View Full Version : CSS classes to resize images



admans
07-18-2005, 17:19 PM
Got bored at College today and decided the fondle about alittle, I didn't know about this untill I did it by an accident. Maybe on other sites, never seen it though. Oh, one thing. Saying stuff like I was looking for somehing like this will be lies. I get it most from my tutorials, sorry for my rudness. =)
To the point.

Here is the code that you can use to resize your images automatically by using CSS




.sig img { max-width: 400px; max-height: 80px; letter-spacing: expression(((this.width>400)?this.width=400:null)?"normal":"normal"); word-spacing: expression(((this.height>80)?this.height=80:null)?"normal":"normal");} .avatar img { max-width: 80px; max-height: 80px; letter-spacing: expression(((this.width>80)?this.width=80:null)?"normal":"normal"); word-spacing: expression(((this.height>80)?this.height=80:null)?"normal":"normal");}



Change the values in px to what you need. For each class, you need to give the same values for all the widths and all the heights.

Each class, that you can rename as you want, can be applied to a div.

For example:




<div class="sig"> HTML code here </div>



If your HTML code contains some images, they will be resized to what you defined in the CSS.