Title: Gallery alignment
Last modified: January 15, 2017

---

# Gallery alignment

 *  [GaryManners](https://wordpress.org/support/users/garymanners/)
 * (@garymanners)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/gallery-alignment-2/)
 * I’ve been using this theme for years, and even use it as a demo for teaching 
   new WordPress users. But, one thing that has always bugged me (and the potential
   users) is the fact that the galleries are left-justified. This always looks awkward
   and is sometimes the make-or-break aspect that keeps someone from adopting this
   theme.
    **A sincere request to center galleries.** [Should you follow-up, this
   will also give the new users I teach an example of how you can contact the developers
   to help improve their product.]

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

 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/gallery-alignment-2/#post-8661074)
 * Hi Gary, and thanks for the feedback, we always appreciate hearing from folks
   about what they like and don’t like in our themes. It’s great to hear that Sela
   has been a good teaching theme.
 * Left-aligning the galleries is an aesthetic decision made by Sela’s designer.
   We wouldn’t be able to make a gallery alignment change in Sela now, because it
   would affect all users of the theme, who would unexpectedly see their galleries
   change position when they update the theme.
 * That said, centering galleries can be done with custom CSS, something that’s 
   easier than ever now that WordPress includes a CSS editor built right into the
   Customizer. If you or your students ever need help with that, we’re here to lend
   a hand.
 * Thanks again for getting in touch!
 *  Thread Starter [GaryManners](https://wordpress.org/support/users/garymanners/)
 * (@garymanners)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/gallery-alignment-2/#post-8661783)
 * Thanks for your quick and explanatory response. I get it.
    Could you post the
   suggested CSS to center align galleries? That would be appreciated and would 
   provide the added benefit of providing an example for when I teach CSS basics.
   Cheers!
 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/gallery-alignment-2/#post-8661834)
 * Sela uses a CSS calculation for thumbnail galleries. For a 3-column gallery this
   should do the trick:
 *     ```
       .gallery-columns-3 .gallery-item {
         max-width: calc(32%);
       }
       ```
   
 * That slightly enlarges each thumbnail to more fully fill up the whole column 
   width.
 * The value of the `max-width` will be different, depending how many columns your
   gallery is. See this previous thread for more details:
 * [https://wordpress.org/support/topic/gallery-not-centered-in-sela-theme/](https://wordpress.org/support/topic/gallery-not-centered-in-sela-theme/)
 * If you use the [Jetpack Tiled Galleries module](https://jetpack.com/support/tiled-galleries/)
   instead of default WordPress galleries, they will always fill the content width,
   so you wouldn’t need to use this trick.
    -  This reply was modified 9 years, 2 months ago by [Kathryn Presner](https://wordpress.org/support/users/zoonini/).
      Reason: fix code formatting
 *  Thread Starter [GaryManners](https://wordpress.org/support/users/garymanners/)
 * (@garymanners)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/gallery-alignment-2/#post-8664854)
 * Thanks but this seems ineffective.
    I have a 3-column gallery on one page where
   nothing seems to change. And I have an 8-column gallery where I got it to work,
   with calc(11.5%), but it breaks on phone and tablet view. The 3-column also breaks
   on phone and tablet view. 3-column: [http://owls.wpstudent.net/gallery-of-maine-owls/](http://owls.wpstudent.net/gallery-of-maine-owls/)
   8-column: [http://owls.wpstudent.net](http://owls.wpstudent.net)
 * Any alternative fix would be appreciated.
 *  Thread Starter [GaryManners](https://wordpress.org/support/users/garymanners/)
 * (@garymanners)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/gallery-alignment-2/#post-8664964)
 * I might have found a solution.
 * I thought that if I made the gallery container (.gallery or .gallery-columns-
   3) less than 100% and use the **margin:0 auto** to align that container on the
   page it might work and it did. You have to fiddle with the percentage based on
   the number of columns but it also seems stable in mobile.
 * I’m leaving the previous method up for a bit so you can still see how that method
   is not working.
 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/gallery-alignment-2/#post-8665857)
 * Ah, the earlier CSS was tested with the default template, but not the full-width
   template, which you’re using for both test pages.
 * Glad you found a method that works.
 * If you’d like to restrict CSS to certain screen widths — for example to exclude
   smaller screens — you’d need to use media queries. You can learn more about them
   here if you’re not familiar with them:
 * [http://en.support.wordpress.com/custom-design/custom-css-media-queries/](http://en.support.wordpress.com/custom-design/custom-css-media-queries/)
   
   [http://css-tricks.com/snippets/css/media-queries-for-standard-devices/](http://css-tricks.com/snippets/css/media-queries-for-standard-devices/)
   [http://webdesignerwall.com/tutorials/responsive-design-with-css3-media-queries](http://webdesignerwall.com/tutorials/responsive-design-with-css3-media-queries)
 *  Thread Starter [GaryManners](https://wordpress.org/support/users/garymanners/)
 * (@garymanners)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/gallery-alignment-2/#post-8684778)
 * I’m back with a postscript, so to speak.
    The above “solution” which I though
   was good turned out to not be effective. After searching around for code snippets
   that might work I was able to cobble together code that worked very well:
 *     ```
       .gallery {
         display: flex;
         justify-content: center;
         flex-wrap: nowrap;
       }
       .gallery-columns-3 {
         display: flex;
         justify-content: center;
         flex-wrap: wrap;
       	width:80%;
       }
       #gallery-6 {
       	margin:0 auto;
       }
       ```
   
 * By making the gallery a flex container I was able to nicely center it.
    The first
   bit on the class .gallery worked for the [8-column gallery](http://owls.wpstudent.net),
   but it didn’t quite adjust the [3-column gallery](http://owls.wpstudent.net/gallery-of-maine-owls/)
   in a way that I liked so I added a few more rules. The .gallery-columns-3 rule
   made it less than 100%, 80% seemed to be the sweet spot. and then the #gallery-
   6 rule zeroed in on that specific gallery and used the standard margin centering
   for block elements. Both galleries seem to work in mobile, though I didn’t widely
   test this.
 * I hope this helps with anyone else wishing to center galleries in the[ Sela ](https://wordpress.com/themes/sela/)
   theme.
 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/gallery-alignment-2/#post-8687707)
 * Thanks for sharing that!
 *  [jjwatkins](https://wordpress.org/support/users/jjwatkins/)
 * (@jjwatkins)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/gallery-alignment-2/#post-9172588)
 * Gary you have saved me soooo much time thanks!!!!

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

The topic ‘Gallery alignment’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/sela/1.0.17/screenshot.png)
 * Sela
 * [Support Threads](https://wordpress.org/support/theme/sela/)
 * [Active Topics](https://wordpress.org/support/theme/sela/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/sela/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/sela/reviews/)

## Tags

 * [alignment](https://wordpress.org/support/topic-tag/alignment/)
 * [center](https://wordpress.org/support/topic-tag/center/)
 * [galleries](https://wordpress.org/support/topic-tag/galleries/)
 * [left justified](https://wordpress.org/support/topic-tag/left-justified/)

 * 9 replies
 * 3 participants
 * Last reply from: [jjwatkins](https://wordpress.org/support/users/jjwatkins/)
 * Last activity: [8 years, 10 months ago](https://wordpress.org/support/topic/gallery-alignment-2/#post-9172588)
 * Status: not a support question