Closed bobbingwide closed 2 years ago
It would appear that this behaviour is explained by Margin collapsing.
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing
I don't believe this problem still exists in its original form. The spacing is now caused by the CSS generated by Gutenberg to separate the top level blocks in a template.
.wp-site-blocks > * + * {
margin-top: var( --wp--style--block-gap );
}
I've already dealt with this for the header. See https://github.com/bobbingwide/fizzie/commit/a3402f08e4b4078f5a1ec85250b123fb62eec9b1 Now to apply the similar logic to the template parts that make up the footer section
In #core-editor Slack I asked some simple questions which resulted in quite a few replies. The result of this was that I decided to extract the navigation menus into separate template parts. I started with the
footer
template part and converted thewp:navigation
into a new template part calledfooter-menu.html
. Rather than embedding this directly into thefooter
template part I decided I'd just put it after thefooter
in each template.But I found a problem with the CSS styling. The footer and footer-menu template were separated with a light grey background between them
I intially thought it was a problem with unexpected characters between the HTML tags. But these were just line feed characters ( \n aka hex 0a ).
I discovered that it was due to the
margin
property set on the nested paragraph and list blocks. I have no idea why the margin on the paragraph was applied the way it did. That's the wonder of CSS for you I suppose.