Skip to content

Commit ff88d49

Browse files
committed
Ensure margin is considered when positioning margin elements
- margins on previous elements weren’t being included when computing their bottom
1 parent fe06992 commit ff88d49

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/resources/formats/html/quarto.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,10 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
427427
const margin = lastBottom - top;
428428
marginChild.style.marginTop = `${margin}px`;
429429
}
430-
lastBottom = top + marginChild.getBoundingClientRect().height;
430+
const styles = window.getComputedStyle(marginChild);
431+
const marginTop = parseFloat(styles["marginTop"]);
432+
433+
lastBottom = top + marginChild.getBoundingClientRect().height + marginTop;
431434
}
432435

433436
// Manage the visibility of the toc and the sidebar

0 commit comments

Comments
 (0)