admin管理员组

文章数量:1122832

I have the following theme.json file in a custom classic/hybrid theme:

theme.json file:

"styles": {
    "elements": {
        "heading": {
            "color": {
                "text": "#000000"
            },
            "typography": {
                "fontWeight": "700",
                "lineHeight": "1.2"
            },
            "spacing": {
                "margin": {
                    "top": "1rem",
                    "right": "0",
                    "bottom": "1rem",
                    "left": "0"
                },
                "padding": {
                    "top": "0",
                    "right": "0",
                    "bottom": "0",
                    "left": "0"
                }
            }
        },
        "h1": {
            "typography": {
                "fontSize": "1.5rem"
            }
        },
        "h2": {
            "typography": {
                "fontSize": "1.375rem"
            }
        },
        "h3": {
            "typography": {
                "fontSize": "1.25rem"
            }
        },
        "h4": {
            "typography": {
                "fontSize": "1.125rem"
            }
        },
        "h5": {
            "typography": {
                "fontSize": "1.063rem"
            }
        },
        "h6": {
            "typography": {
                "fontSize": "1rem"
            }
        }
    },
    "blocks": {
        "core/post-title": {
            "typography": {
                "fontSize": "1rem"
            }
        },
    }
}

This is the CSS code generated by Gutenberg:

Generated CSS:

.editor-styles-wrapper h2 {
  font-size: 1.375rem;
}

.editor-styles-wrapper h1,
.editor-styles-wrapper h2,
.editor-styles-wrapper h3,
.editor-styles-wrapper h4,
.editor-styles-wrapper h5,
.editor-styles-wrapper h6 {
  color: #000000;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 1rem;
  margin-right: 0;
  margin-bottom: 1rem;
  margin-left: 0;
  padding-top: 0;
  padding-right: 0;
  padding-bottom: 0;
  padding-left: 0;
}

.editor-styles-wrapper :where(.wp-block-post-title) {
  font-size: 1rem;
}

As you can see, the generic h1, h2, h3, h4, h5 and h6 styles take precedence over the specific .wp-block-post-title block styles. Is this the expected behavior? Can it be switched so that .wp-block-post-title has a higher priority?

本文标签: cssStyle priority in themejson