• I manually created a gallery on a page and that looks great, 3 columns, all images automatically cropped to the same height (even though my original images are all different sizes).

    But when I use a gallery shortcode [gallery columns="3" size="medium" link="none" ids="13,14,11,16,18,19"] it displays a 3 column gallery but the images heights don’t match on each row, and it leaves ugly space below panoramic images.

    How can I get it so that the height of all images on each row is the same, even if it automatically crops away some of the sides of each image?

    • This topic was modified 3 years, 5 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Because the gallery shortcode sets img tag style attributes, it’s impractical to apply proper CSS to achieve your goals. Your best option is to create a custom image size where the height is fixed and width cropped. Then specify this size as your gallery images size.
    https://developer.www.ads-software.com/reference/functions/add_image_size/
    Note the section on media library images. This added image size is only available for images uploaded after the size was added.

Viewing 1 replies (of 1 total)
  • The topic ‘Fit images in gallery’ is closed to new replies.