Making Posts editor client friendly

Hi @owynter,

I’m also concerned about clients editing posts, and after some trials and errors, I finally ended up with this simple CSS for post/page editing:

.is-root-container.wp-block-post-content {
    max-width: 80ch;
    margin: 0 auto;
    padding: 1em;
}

I tried to find something like this before in vain, but today it looked obvious with the ‘.wp-block-post-content’ added to ‘.is-root-container’ only for posts and not for templates.

Maybe this class has been added in some recent WP update or maybe I had not seen it before :wink:

Note that you can restrain this to certain post types if you need so:

.post-type-TYPE .is-root-container.wp-block-post-content {
    max-width: 80ch;
    margin: 0 auto;
    padding: 1em;
}

Where TYPE can be ‘page’ or any CPT slug.

Also note that you CAN’T use the second method in Cwicly stylesheets because ‘.editor-style-wrapper’ will be added at the beginning of the rule, so before ‘.post-type-TYPE’, which is a <body> class, so the selector will be invalid.
So you’ll have to include the CSS a different way.
(But the first one is OK if you don’t need specificity.)

1 Like