Site logo

Archived topic

Images of Woocommerce at the same height

11 replies · Started by Alberto on October 19, 2018

Viewing posts 1–12 of 12

Hi.

How would you have to configure GP so that the woocommerce images have the same height, regardless of the size of the images?

Thank you in advance.

Problem

Hi there,

can you link me to the Site? you can edit the original topic and use the Site URL for privacy.
We may be able to use some CSS to make this happen. But ideally it is better to use images that are all the same aspect ratio.

Hi.

I just edited the url of the site.

Thanks since now!

OK, so try this CSS:

@media (min-width: 768px) {
    .inside-wc-product-image {
        width: 100%;
    }
    .woocommerce ul.products li.product a img {
        height: 200px; /* adjust height */
        object-fit: cover;
    }
}

Thank you! It worked perfectly!

Can the height of the titles also be equal?

Thank you in advance.

Try this:

.woocommerce ul.products li.product h2 {
    line-height: 2.5ex;
  	height: 7.5ex;
  	overflow: hidden;
}

Thank you! It worked perfectly!

Awesome :) Glad i could be of help.

Hello David, I am trying to to the same Alberto asked, but I want the images centered horizontally. The CSS seems to affect the magnifier icon position as well as the product gallery thumbnails.

This is the code I am using:

@media (min-width: 768px) {
    .inside-wc-product-image {
        width: 100%;
    }
    .woocommerce div.product div.images img {
        height: 700px; /* adjust height */
        width: auto;
        margin: 0 auto;
    }
}

.woocommerce div.product div.images .woocommerce-product-gallery__trigger {
    margin: 0 auto;
}

A sample of a long vertical image: http://35.232.201.230/~suzanne2/shop/publications/embodied-fantasies-from-awe-to-artifice/
A sample of a gallery with 3 images: http://35.232.201.230/~suzanne2/shop/artworks/remote-sensing/remote-sensing-01/

Note images get distorted... What do you recommend?

Thanks

Hi there,

its best to avoid the CSS for now, the key thing with Woocommerce images is:

1. Original Image should be large enough for your Single Product Magnified image around 1.5x to 2x the Main Image unzoomed.
2. The Customizer > Woocommerce > Main Image width should be equal to the Container width.
2.1 The Container width is set as a % in Customizer > Layout > Woocommerce > Product Image Area Width - currently yours is 60% of the Page Container width which is set to 1400px. So the Main Image Width should be 840px in your current set-up. This means your original image needs to be larger ( refer back to point 1 )

Thanks for this code David, simple and works. I changed: object-fit: cover; to object-fit: contain; which suited my needs.

You're welcome

This archived topic is closed to new replies.