Grow your CSS skills. Land your dream job.

cropping images with CSS

  • # July 8, 2009 at 3:04 pm

    Hey guys and Gals. I was wondering if anyone new of a way to crop or clip images to a specified size (ie. 100px x 100px). I have images that are being loaded from a database (this is supposed to be a photo gallery). Some images are 100px 150px but I really want the thumbnails to be the same size. Is this possible? I know there are ways to clip background images, but these images will be added dynamically and I don’t want to have distorted thumbnails.

    Thanks for help/advice.
    Mark

    # July 8, 2009 at 3:12 pm

    You could wrap the images in container elements (DIV, LI, etc), set a fixed height and width, and then set overflow:hidden.

    # July 8, 2009 at 3:13 pm

    PHP is your best option http://phpthumb.sourceforge.net/

    # July 8, 2009 at 3:48 pm

    thanks for your help. I will be giving both a try. Keep you posted.

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

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".