Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

image resize css 1

Status
Not open for further replies.
Jul 28, 2005
358
FR
Hi,

I resize some images on a page using css(can't do it using normal html as the page is rendered using an encoded php script and I can only change the css for the template - images are called in the template using tags <%picture%>.

So, I resize using this css
Code:
.resizedImage img {

 width:139px;
 height:118px;
 border:1px solid black;
}

Fine if all the images have the same dimensions. But, some are taller than others so when they resize they appear squashed.

Is there anyway way I can resize them along just one axis and have the other axis resize automatically?

Richard
 
Yes. Specify your CSS like this:
Code:
.resizedImage img {
 width:139px;
 height:auto;
 border:1px solid black;
}
You could even try removing the height (or width if you are setting that to be auto) which would work if it hasn't been set previously.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top