From 7191e259584e339b499a63e2e60cb6d818222e18 Mon Sep 17 00:00:00 2001 From: Xin Date: Sat, 3 Feb 2024 09:09:16 -0500 Subject: [PATCH] fix: set top margin to zero for nested list (#276) --- assets/css/compiled/main.css | 6 ++++++ assets/css/typography.css | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index 0e0a1104..bb386404 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -1701,6 +1701,12 @@ video { margin-top: 0.5rem; margin-bottom: 0.5rem; } +/* This CSS rule targets the first nested unordered (ul) or ordered (ol) list + inside the first list item (li) of any parent ul or ol. + The rule sets the top margin of the selected list to zero. */ +.content :where(ul, ol) > li:first-child > :where(ul, ol):not(:where([class~=not-prose],[class~=not-prose] *)) { + margin-top: 0px; +} .content :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)) { overflow-wrap: break-word; border-radius: 0.375rem; diff --git a/assets/css/typography.css b/assets/css/typography.css index 7bee5111..776f0df7 100644 --- a/assets/css/typography.css +++ b/assets/css/typography.css @@ -57,6 +57,12 @@ @apply my-2; } } + /* This CSS rule targets the first nested unordered (ul) or ordered (ol) list + inside the first list item (li) of any parent ul or ol. + The rule sets the top margin of the selected list to zero. */ + :where(ul, ol) > li:first-child > :where(ul, ol):not(:where([class~=not-prose],[class~=not-prose] *)) { + @apply mt-0; + } :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)) { @apply border-black border-opacity-[0.04] bg-opacity-[0.03] bg-black break-words rounded-md border py-0.5 px-[.25em] text-[.9em] dark:border-white/10 dark:bg-white/10; }