Unexpected CSS margins added to container blocks #34716
Labels
CSS Styling
Related to editor and front end styles, CSS-specific issues.
[Feature] Themes
Questions or issues with incorporating or styling blocks in a theme.
[Type] Bug
An existing feature does not function as intended
Description
As of #33812, spacing gaps are automatically applied to FSE themes. That can cause unexpected results for theme authors in some situations.
I thought it'd be helpful to have an issue where we can post those use cases. Please add comments here when you encounter one.
Step-by-step reproduction instructions
Both of these are with the default
24px
gap, rather than defining one intheme.json
..site-header
is given amargin-top
because.skip-link
precedes it:I expected it to have none, since it's the site header and the preceding element is visually hidden. maybe fix by adding a
not(.screen-reader-text)
selector. that wouldn't catch everything, but it might get most.More broadly, child elements of
.site-header
and.site-footer
are givenmargin-top
, but I'd expect only post content and the sidebar to be affected. I don't really see a logical relationship in those areas like there is with elements inside post content.Maybe in general-purpose themes everything should be affected, but not in a custom theme where the header/footer are locked.
( previously mentioned by @chthonic-ds )
Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: