diff --git a/resources/skins.vector.styles/typography.less b/resources/skins.vector.styles/typography.less index 6d65a67e9..f471ea568 100644 --- a/resources/skins.vector.styles/typography.less +++ b/resources/skins.vector.styles/typography.less @@ -40,14 +40,12 @@ pre, .mw-body { // h1's can exist outside of `.mw-body-content` so some heading styles // therefore need to be defined in `.mw-body` as well. - & h1, - & .mw-heading1, + h1, + .mw-heading1, &-content h1, &-content .mw-heading1, &-content h2, &-content .mw-heading2 { - margin-bottom: 0.25em; - padding: 0; font-family: @font-family-serif; line-height: @line-height-xx-small; @@ -70,8 +68,8 @@ pre, } } - & h1, - & .mw-heading1, + h1, + .mw-heading1, &-content h1, &-content .mw-heading1 { font-size: @font-size-heading-1; @@ -79,7 +77,6 @@ pre, .mw-heading2, h2 { - margin-top: 1em; font-size: @font-size-heading-2; } @@ -91,12 +88,28 @@ pre, h5, .mw-heading6, h6 { - margin-top: 0.3em; - margin-bottom: 0; + // Additional bottom padding isnt necessary because only the h2 has an underline padding-bottom: 0; line-height: @line-height-base; } + .mw-heading2, + h2, + .mw-heading3, + h3, + .mw-heading4, + h4, + .mw-heading5, + h5, + .mw-heading6, + h6 { + // Headings should have extra spacing from its siblings, which is a + //

element most of the time. In this case, spacing from the heading + // the

is sufficient. However, we to account for cases + // where the previous sibling element doesnt have any spacing + margin: 0.25em 0 0.25em 0; + } + .mw-heading3, h3 { font-size: @font-size-heading-3; @@ -119,7 +132,12 @@ pre, } p { - margin: 0.5em 0 1em 0; + // T351754 Use padding to avoid margin collapsing between adjacent

elements + // creating an effective margin-bottom: 1em + padding-bottom: 0.5em; + // Top margin is needed because many elements rely on adjacent

elements + // for extra spacing, i.e. lists and headings + margin: 0.5em 0 0 0; } blockquote { @@ -135,6 +153,13 @@ pre, margin-bottom: 0; } } + + ul, + ol { + // Override default spacing so that lists entirely rely on adjacent sibling elements for spacing + // FIXME: Remove !important with T354975 + margin-top: 0 !important; /* stylelint-disable-line declaration-no-important */ + } } // T335625 - Move siteSub into common.less to prevent it from being feature-flagged