Inconsistent nested container alignment
-
I have a few top level Containers on a page (sections) and in each “Container”, there is an “Inner Container” (also a GB Container). They both are
display:blockby default. Each “Inner Container” has a similar named global class.inner-container, which hasmargin-left:autoandmargin-right:autoset to center them. With this, the “Inner Container” is automatically positioned to center on the frontend. However, if I don’t set the “auto” margins explicitly on the “Inner Container” blocks in the Block Editor, the container floats to the left, because in Block Editor, there is also a hardcoded.gb-container>.wp-block { margin-left:0; margin-right:0 }css, coming from “generateblocks/dist/blocks.css”, which overwrites the Global Style’s CSS.
See: https://imgur.com/a/udJV9DJIs this something you are aware of? I’ve tried temporarily disabling
.gb-container>.wp-blockCSS in inspector, and this way some containers showed up correctly, but also others are don’t. I realized that the reason is that WP Block Editor’s default CSS also definesmargin-left:autofor all.wp-blockand in the Block Editor (and only there) all.gb-containerare also a.wp-block. This causes inconsistency with margins on blocks in the Block Editor and the Frontend.
The topic ‘Inconsistent nested container alignment’ is closed to new replies.