Make paragraph spacing 0.5em top and 1em bottom by default, handle adjacent inline elements manually

Bug: T366389
Change-Id: If83c7af5ccd4147bcf9b45436c905efac865b98a
This commit is contained in:
bwang 2024-05-28 12:34:18 -05:00 committed by Bernard Wang
parent 4664ecf49a
commit 225a02ff20

View file

@ -145,12 +145,18 @@ pre,
}
p {
// T351754 Use padding to avoid margin collapsing between adjacent <p> elements
// creating an effective margin-bottom: 1em
padding-bottom: 0.5em;
// Top margin is needed because many elements rely on adjacent <p> elements
// for extra spacing, i.e. lists and headings
margin: 0.5em 0 0 0;
margin: 0.5em 0 1em 0;
}
p + ul,
p + ol,
p + table,
p + dl,
p + blockquote {
// Inline elements should have 0.5em total top spacing
// Use negative margin to account for 1em bottom margin on paragraphs
// This will not work for floated elements
margin-top: -0.5em;
}
blockquote {
@ -166,12 +172,6 @@ pre,
margin-bottom: 0;
}
}
ul,
ol {
// Override default spacing so that lists entirely rely on adjacent sibling elements for spacing
margin-top: 0;
}
}
// T335625 - Move siteSub into common.less to prevent it from being feature-flagged