Skip to content

Commit

Permalink
Fix image block centering when resizing to a smaller size (#26376)
Browse files Browse the repository at this point in the history
* Fix image block centering when resizing to a smaller size

* Revert previous 100% width fix

* Remove display: table when image block is resized to avoid centering of block

* Match frontend classes for alignment in editor
  • Loading branch information
talldan authored and tellthemachines committed Nov 11, 2020
1 parent ba3b39d commit 316601e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 13 additions & 0 deletions packages/block-library/src/image/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ figure.wp-block-image:not(.wp-block) {
}
}

.wp-block[data-align="left"],
.wp-block[data-align="center"],
.wp-block[data-align="right"] {
> .wp-block-image {
display: table;

> figcaption {
display: table-caption;
caption-side: bottom;
}
}
}

.wp-block[data-align="left"] > .wp-block-image {
margin-right: 1em;
margin-left: 0;
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/image/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

.alignleft,
.alignright,
.aligncenter,
&.is-resized {
.aligncenter {
display: table;

> figcaption {
Expand Down

0 comments on commit 316601e

Please sign in to comment.