Site logo

Archived topic

Gallery Spacing

3 replies · Started by Carl on September 11, 2022

Viewing posts 1–4 of 4

Hi - I looked for this information, but I couldn't find anything that helped with my theme. My gallery has a lot of spacing/margin between the images and caption - vertically and horizontally. How can I reduce this?

I tried targeting the block gallery, but then other things shifted as well.

.wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image){margin:0px -20px -40px -20px !important;}
.wp-block-gallery{margin:0px 20px 20px 20px;}

Hi Carl,

Can you try this CSS?:

.wp-block-gallery {
    gap: 0.2em;
}

This would work on all WP Gallery Blocks. If you want it more specific, add a class to the class list of your Gallery Blocks and add that as a selector for your CSS.

An alternative would be to use a GenerateBlocks Grid Blocks which has spacing settings you can easily modify: https://docs.generateblocks.com/article/grid-overview/

I just added an !important and that works perfect - thanks!

You're welcome Carl!

This archived topic is closed to new replies.