Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
13
rated 0 times [  18] [ 5]  / answers: 1 / hits: 173467  / 15 Years ago, thu, april 16, 2009, 12:00:00

Here's the problem. I have an image:



<img alt=alttext src=filename.jpg/>


Note no height or width specified.



On certain pages I want to only show a thumbnail. I can't alter the html, so I use the following CSS:



.blog_list div.postbody img { width:75px; }


Which (in most browsers) makes a page of uniformly wide thumbnails, all with preserved aspect ratios.



In IE6 though, the image is only scaled in the dimension specified in the CSS. It retains the 'natural' height.



Here's an example of a pair of pages that illustrate the problem:





I'd be very grateful for all suggestions, but would like to point out that (due to the limitations of the clients chosen platform) I'm looking for something that doesn't involve modifying the html. CSS would also be preferable to javascript.



EDIT: Should mention that the images are of different sizes and aspect ratios.


More From » css

 Answers
20

Adam Luter gave me the idea for this, but it actually turned out to be really simple:



img {
width: 75px;
height: auto;
}


IE6 now scales the image fine and this seems to be what all the other browsers use by default.



Thanks for both the answers though!


[#99695] Thursday, April 9, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alekgermanb

Total Points: 616
Total Questions: 86
Total Answers: 105

Location: Aland Islands
Member since Thu, Dec 23, 2021
2 Years ago
alekgermanb questions
Sun, Mar 20, 22, 00:00, 2 Years ago
Sat, Jan 2, 21, 00:00, 3 Years ago
Sun, Nov 17, 19, 00:00, 5 Years ago
;