Skip to content

Commit

Permalink
Improve handling of centered 1-col galleries with small images (#11040)
Browse files Browse the repository at this point in the history
* Improve handling of centered 1-col galleries with small images

If you insert a gallery that has a single column, and multiple smallish images, then center it, the images inside do not appear centered.

This is technically correct, since the _gallery itself_ is centered, but because it's full width and because the images might vary in widths, this doesn't appear to make any difference to the content inside. So although "correct", it's not a good user experience.

This PR simply centers the content also.

* Remove editor specific alignments.
  • Loading branch information
jasmussen authored Oct 25, 2018
1 parent 3c81345 commit 37e6b13
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/block-library/src/gallery/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@
}

// Apply max-width to floated items that have no intrinsic width.
[data-align="left"] &,
[data-align="right"] &,
&.alignleft,
&.alignright {
max-width: $content-width / 2;
Expand All @@ -148,4 +146,11 @@
&.alignright {
display: flex;
}

// If the gallery is centered, center the content inside as well.
&.aligncenter {
.blocks-gallery-item figure {
justify-content: center;
}
}
}

0 comments on commit 37e6b13

Please sign in to comment.