Skip to content

Commit 3e59512

Browse files
Increase top margin for long list items
List items inside `#content` use `var(--space-sm)` as their top margin because `var(--space)` looks too disjointed for single-paragraph items, especially single-line items. However, when a list item contains an element that itself has a `var(--space)` top margin, the list item's top margin looks mismatched. This commit adds a style tweak such that all list items in a list with any multi-paragraph items will use `var(--space)` for their top margin. (More specifically, when any item contains a paragraph plus another block level element, such as another paragraph or a code block.) Unfortunately, this enhancement does not currently work in Firefox because it relies on the `:has()` selector. However, it is only a minor enhancement, and Firefox plans to support `:has()` in the near future.
1 parent 3f0fee5 commit 3e59512

File tree

1 file changed

+5
-0
lines changed
  • lib/rdoc/generator/template/rails/resources/css

1 file changed

+5
-0
lines changed

lib/rdoc/generator/template/rails/resources/css/main.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,11 @@ html {
382382
margin-top: var(--space-sm);
383383
}
384384

385+
/* Increase top margin for list items when any item has more than one paragraph */
386+
:where(#content :is(ol, ul):has(> li > p:not(:only-child))) * + li {
387+
margin-top: var(--space);
388+
}
389+
385390
:where(#content) code {
386391
font-style: normal;
387392
}

0 commit comments

Comments
 (0)