如何在二十二十一主题中使内容区域全宽?

How to make content area in full width in Twenty Twenty-One theme?

我有一个儿童二十二十一主题,我想使内容区充满。我不想使用任何插件。我已经搜索并发现在 CSS 中添加以下代码可能有效,但对我来说它不起作用。

如果可能的话,如何使用 css 来实现?

澄清一下,2021 年页眉、页脚等比 post 内容、页面内容等主要内容区域更宽

我们如何使内容区域(post、页面、列表)的宽度与 header/footer 相同?

.entry-content > *:not(.alignwide):not(.alignfull):not(.alignleft):not(.alignright):not(.is-style-wide) {
max-width: 87rem;
width: calc(100% - 8rem);
}

请使用以下样式

    .entry-content > *:not(.alignwide):not(.alignfull):not(.alignleft):not(.alignright):not(.wp-block-separator):not(.woocommerce) {
      width: 100%;
      max-width: 1240px;
    }

在 WordPress 中要更改样式,您需要使用检查代码并获取 CSS 定义,然后对其进行修改。这并不难。 试试下面的代码,你可以在我的博客上看到更多关于 https://ajaytechie.com/wordpress/how-to-change-width-of-post-content-area-in-twenty-twenty-one-wordpress-theme.html 的解释,你也可以看到它的实际效果。

/* Change the content width to be same as header/nav/footer's width */
@media only screen and (min-width: 822px) {
    :root {
        --responsive--aligndefault-width: min(calc(100vw - 8 * var(--global--spacing-horizontal)), 1240px);
    }
}