Site logo

Archived topic

Image Gallery Stack on Mobile

3 replies · Started by SLIM on February 15, 2023

Viewing posts 1–4 of 4

I'd like to PREVENT the image gallery from stacking on mobile.

I've set the columns to 6 (as i'm displaying 6 icons) which is very doable on a mobile screen.
However, on mobile it keeps switching it to TWO columns.

I tried editing WHILST in mobile view and there does not seem to be a separate editor for it?

Thanks.

Hi there,

add this CSS to your site:

figure.wp-block-gallery.grid-of-six {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
}

.wp-block-gallery.grid-of-six  figure.wp-block-image {
    width: 100% !important;
}

then in the editor, select the Gallery Block, and in Advanced > Additional CSS Class(es) add: grid-of-six
any gallery with that class should now remain 6 columns on all devices.

My man! :)
Thank you.

Works flawlessly.

Glad to hear that

This archived topic is closed to new replies.