Treehouse: Grow your CSS skills. Land your dream job.

Propotional resize

  • # May 11, 2012 at 8:00 am

    I want to resize the images so they occupy all the 170px and show the most of the image. Is it possible just with css?

    # May 11, 2012 at 8:27 am

    Um, width 100%? No?

    # May 11, 2012 at 9:04 am

    no, there is the problem if the image with more height that width..

    # May 11, 2012 at 9:38 am

    I tried with width:100% and still not working..

    # May 11, 2012 at 9:41 am

    You need JavaScript if you want to do that. You want to variably resize the image based on the original dimensions. To do that, I am pretty sure you’ll need the object model that JS provides.

    # May 11, 2012 at 9:48 am

    You can’t have it both ways, either they scale to the width or the height.

    Simple answer, size your images appropriately before using.

    # May 11, 2012 at 11:07 am

    thank you for the answers, I really want to give liberty to my client so I’ll use javascript.

    # May 11, 2012 at 3:23 pm

    Assuming that they will all be bigger than 170×170 you could put it on the background:

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.