Skip to content

Commit

Permalink
Try: Reduce specificity of reset & classic styles. (#32659)
Browse files Browse the repository at this point in the history
* Try: Reduce specificity of reset & classic styles.

* Restore specificity of classic auto margin rule.
  • Loading branch information
jasmussen committed Aug 9, 2021
1 parent f9f6cf0 commit 7f97d5c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion packages/block-library/src/reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* of the editor by themes.
*/

.editor-styles-wrapper {
// We use :where to keep specificity minimal.
// https://css-tricks.com/almanac/selectors/w/where/
html :where(.editor-styles-wrapper) {
padding: 8px;

/**
Expand Down
10 changes: 6 additions & 4 deletions packages/edit-post/src/classic.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// This needs specificity to override the editor styles.
// Provide baseline auto margin for centering blocks.
// Specificity is kept at this level as many classic themes output
// rules like figure { margin: 0; } which would break centering.
.editor-styles-wrapper .wp-block {
margin-left: auto;
margin-right: auto;
}

// Depreacted style needed for the block widths and alignments.
// for themes that don't support the new layout (theme.json)
.wp-block {
// Deprecated style needed for the block widths and alignments.
// for themes that don't support the new layout (theme.json).
html :where(.wp-block) {
max-width: $content-width;

// Provide every block with a default base margin. This margin provides a consistent spacing
Expand Down

0 comments on commit 7f97d5c

Please sign in to comment.