Skip to content

Commit a66ab1d

Browse files
committed
calculate h1, h2 top and bottom margins based on font line height
1 parent d22ed31 commit a66ab1d

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/themes/shared/_markdown.css

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@
259259

260260
h1,
261261
h2 {
262-
margin-top: 2.5rem;
262+
margin-top: calc(2.5rem - (1lh - 1.275em));
263263
}
264264

265265
:is(h1, h2, h3, h4, h5, h6) + * {
@@ -275,14 +275,8 @@
275275
}
276276

277277
h2 {
278-
--_spacing: 0.5em;
279-
--_line-height-muliplier: 0.9;
280-
281-
margin-bottom: calc(
282-
var(--_spacing) + (1lh * var(--_line-height-muliplier)) -
283-
var(--font-size-xxl)
284-
);
285-
padding-bottom: var(--_spacing);
278+
margin-bottom: 0.65em;
279+
padding-bottom: calc(0.5em - (1lh - 1.275em));
286280
border-bottom: 1px solid var(--border-color);
287281
font-size: var(--font-size-xxl);
288282
}

0 commit comments

Comments
 (0)