xml2rfc icon indicating copy to clipboard operation
xml2rfc copied to clipboard

HTML styles for compact lists are not compact

Open martinthomson opened this issue 1 year ago • 0 comments

Describe the issue

The compact styling on definition lists (<dl spacing="compact">) does not appear to function properly.

https://www.ietf.org/archive/id/draft-ietf-ohai-ohttp-06.html#section-9.1 includes a large definition list that uses the compact spacing, however it does not render very differently from the normal one. My expectation is that the compact spacing approximates the inter-line spacing of a regular paragraph, but this appears to be half-way between that and the full spacing.

(Separately, the full spacing is extremely wide, which might have the same cause.)

My investigation shows that this is due to the content of the <dd> element including elements (<p> in this case) that have their own margins. These margins still apply, but it appears to expand the spacing between items.

I found that the following works, even if it is a little clunky:

:is(dl.compact, .dlCompact) > dd > :is(:first-child, .break:first-child + *) {
  margin-top: 0;
}
:is(dl.compact, .dlCompact) > dd > :last-child {
  margin-bottom: 0;
}

(The .break elements that are scattered throughout are a little annoying to style around; I just set them to display: none but then I need to do this hack here. The dl.compact rule is for Julian's XSLT output, but it's been a while since I checked how that renders; ignore that one.)

Code of Conduct

martinthomson avatar Feb 02 '23 06:02 martinthomson