Skip to content

Commit

Permalink
Restore the margins of blocks relying on the figure element (#29517)
Browse files Browse the repository at this point in the history
* Restore the margins of blocks relying on the figure element

* Remove margin bottom from the embed figure

* Restore bottom margin for empty figure blocks
  • Loading branch information
youknowriad authored Mar 8, 2021
1 parent a81afe8 commit 4cc2212
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
2 changes: 2 additions & 0 deletions packages/block-library/src/audio/style.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.wp-block-audio {
margin: 0 0 1em 0;

// Supply caption styles to audio blocks, even if the theme hasn't opted in.
// Reason being: the new markup, <figcaptions>, are not likely to be styled in the majority of existing themes,
// so we supply the styles so as to not appear broken or unstyled in those themes.
Expand Down
5 changes: 2 additions & 3 deletions packages/block-library/src/embed/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@
}

.wp-block-embed {
margin: 0 0 1em 0;

// Supply caption styles to embeds, even if the theme hasn't opted in.
// Reason being: the new markup, figcaptions, are not likely to be styled in the majority of existing themes,
// so we supply the styles so as to not appear broken or unstyled in those.
figcaption {
@include caption-style();
}
// The embed block is in a `figure` element, and many themes zero this out.
// This rule explicitly sets it, to ensure at least some bottom-margin in the flow.
margin-bottom: 1em;

// Don't allow iframe to overflow it's container.
iframe {
Expand Down
4 changes: 1 addition & 3 deletions packages/block-library/src/image/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
.wp-block-image {
// The image block is in a `figure` element, and many themes zero this out.
// This rule explicitly sets it, to ensure at least some bottom-margin in the flow.
margin-bottom: 1em;
margin: 0 0 1em 0;

img {
max-width: 100%;
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/pullquote/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.wp-block-pullquote {
margin: 0 0 1em 0;
padding: 3em 0;
margin-left: 0;
margin-right: 0;
text-align: center;

&.alignleft,
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/table/style.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.wp-block-table {
margin: 0 0 1em 0;
$subtle-light-gray: #f3f4f5;
$subtle-pale-green: #e9fbe5;
$subtle-pale-blue: #e7f5fe;
Expand Down
4 changes: 1 addition & 3 deletions packages/block-library/src/video/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
.wp-block-video {
// Remove the left and right margin the figure is born with.
margin-left: 0;
margin-right: 0;
margin: 0 0 1em 0;

video {
width: 100%;
Expand Down

0 comments on commit 4cc2212

Please sign in to comment.