Title: CSS code to limit gallery width
Last modified: November 19, 2024

---

# CSS code to limit gallery width

 *  Resolved [gebseng](https://wordpress.org/support/users/gebseng/)
 * (@gebseng)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/css-code-to-limit-gallery-width/)
 * Hi, what is the CSS code to limit the width of a Simply Gallery block on a wordpress
   page?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcss-code-to-limit-gallery-width%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Author [GalleryCreator](https://wordpress.org/support/users/gallerycreator/)
 * (@gallerycreator)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/css-code-to-limit-gallery-width/#post-18146770)
 * Hello,
 * Gallery uses 100% width of parent container. But if you want CSS, try this
 * `.pgcsimplygalleryblock-grid-collection{width:50%;}`
 *  (add as Custom CSS).
 *  Thread Starter [gebseng](https://wordpress.org/support/users/gebseng/)
 * (@gebseng)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/css-code-to-limit-gallery-width/#post-18148030)
 * Thanks for the suggestion! I added this to my Custom CSS, tried different values,
   but the width of the Simply Gallery block did not change. My goal is to make 
   the gallery block a little less wide than 100% of the parent container. I managed
   to do this with the Envira Galleries I used before Simply Gallery with Custom
   CSS code.
 *  Plugin Author [GalleryCreator](https://wordpress.org/support/users/gallerycreator/)
 * (@gallerycreator)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/css-code-to-limit-gallery-width/#post-18148737)
 * I looked at your page and didn’t see any Custom CSS added to your gallery. That’s
   why it didn’t work.
 * ![](https://monosnap.com/image/vz5kQrFmj6WzXE5BYcUXLdVJDHypfq)
 *  Thread Starter [gebseng](https://wordpress.org/support/users/gebseng/)
 * (@gebseng)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/css-code-to-limit-gallery-width/#post-18148776)
 * Sorry, I had added it to the global Custom CSS first.
 * Now I added the code to the Custom CSS of this gallery. When I preview the gallery,
   it’s downsized to 50% width as it should, thanks! [https://fotosengmueller.com/pgc_simply_gallery/leben-an-der-grenze/](https://fotosengmueller.com/pgc_simply_gallery/leben-an-der-grenze/)
 * However, on the actual page it’s still at 100% width, maybe a caching issue, 
   I’ll look at it again later. [https://fotosengmueller.com/leben-an-der-grenze-stadtmuseum-waidhofen/](https://fotosengmueller.com/leben-an-der-grenze-stadtmuseum-waidhofen/)
 *  Plugin Author [GalleryCreator](https://wordpress.org/support/users/gallerycreator/)
 * (@gallerycreator)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/css-code-to-limit-gallery-width/#post-18148806)
 * This custom CSS needs to be added to each gallery you want to change.
 * There is no custom CSS in the gallery on this page [https://fotosengmueller.com/leben-an-der-grenze-stadtmuseum-waidhofen/](https://fotosengmueller.com/leben-an-der-grenze-stadtmuseum-waidhofen/)
 *  Thread Starter [gebseng](https://wordpress.org/support/users/gebseng/)
 * (@gebseng)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/css-code-to-limit-gallery-width/#post-18148815)
 * No, I did add it to this gallery, and it works if you go to [https://fotosengmueller.com/pgc_simply_gallery/leben-an-der-grenze/](https://fotosengmueller.com/pgc_simply_gallery/leben-an-der-grenze/)
 *  Thread Starter [gebseng](https://wordpress.org/support/users/gebseng/)
 * (@gebseng)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/css-code-to-limit-gallery-width/#post-18148859)
 * Of course your suggestion works! I mixed up two similar galleries. sorry for 
   wasting your time and thanks again!
 *  Plugin Author [GalleryCreator](https://wordpress.org/support/users/gallerycreator/)
 * (@gallerycreator)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/css-code-to-limit-gallery-width/#post-18149491)
 * 👍

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘CSS code to limit gallery width’ is closed to new replies.

 * ![](https://ps.w.org/simply-gallery-block/assets/icon-256x256.png?rev=2543539)
 * [Mixed Media Gallery Blocks](https://wordpress.org/plugins/simply-gallery-block/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simply-gallery-block/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simply-gallery-block/)
 * [Active Topics](https://wordpress.org/support/plugin/simply-gallery-block/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simply-gallery-block/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simply-gallery-block/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [GalleryCreator](https://wordpress.org/support/users/gallerycreator/)
 * Last activity: [1 year, 7 months ago](https://wordpress.org/support/topic/css-code-to-limit-gallery-width/#post-18149491)
 * Status: resolved