From 6a4947b8467bb7e97d03c8635c52aeb48de8ec65 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Wed, 8 Mar 2023 14:28:05 +1100 Subject: [PATCH] Reduce specificity of block margin styles. --- packages/block-library/src/file/style.scss | 7 +++++-- packages/block-library/src/post-excerpt/style.scss | 3 ++- packages/block-library/src/pullquote/style.scss | 6 +++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/block-library/src/file/style.scss b/packages/block-library/src/file/style.scss index 8c9708bda57551..e34935833e13cd 100644 --- a/packages/block-library/src/file/style.scss +++ b/packages/block-library/src/file/style.scss @@ -1,6 +1,4 @@ .wp-block-file { - margin-bottom: 1.5em; - &:not(.wp-element-button) { font-size: 0.8em; } @@ -19,6 +17,11 @@ } } +// Lowest specificity to avoid overriding layout styles. +:where(.wp-block-file) { + margin-bottom: 1.5em; +} + .wp-block-file__embed { margin-bottom: 1em; } diff --git a/packages/block-library/src/post-excerpt/style.scss b/packages/block-library/src/post-excerpt/style.scss index 60ad186da6acc3..1562bca962c1c9 100644 --- a/packages/block-library/src/post-excerpt/style.scss +++ b/packages/block-library/src/post-excerpt/style.scss @@ -1,4 +1,5 @@ -.wp-block-post-excerpt { +// Lowest specificity on wrapper margins to avoid overriding layout styles. +:where(.wp-block-post-excerpt) { margin-top: var(--wp--style--block-gap); margin-bottom: var(--wp--style--block-gap); } diff --git a/packages/block-library/src/pullquote/style.scss b/packages/block-library/src/pullquote/style.scss index 79591d82f157cd..94d043d1cf2f5b 100644 --- a/packages/block-library/src/pullquote/style.scss +++ b/packages/block-library/src/pullquote/style.scss @@ -1,5 +1,4 @@ .wp-block-pullquote { - margin: 0 0 1em 0; padding: 3em 0; text-align: center; // Default text-alignment where the `textAlign` attribute value isn't specified. overflow-wrap: break-word; // Break long strings of text without spaces so they don't overflow the block. @@ -25,6 +24,11 @@ } } +// Lowest specificity to avoid overriding layout styles. +:where(.wp-block-pullquote) { + margin: 0 0 1em 0; +} + // Ensure that we are reasonably specific to override theme defaults. .wp-block-pullquote.has-text-align-left blockquote { text-align: left;