Open martinthomson opened 2 years ago
FWIW, I tried a few things that don't work:
dl { --indent: 3ch; }
dl[indent] { --indent: calc(attr(indent) * 1ch); }
dl > dd { margin-left: var(--indent); }
That does suggest a way to compress the above though:
dl[indent="3"] { --dli: 3ch; }
/* and so on */
dl > dd { margin-left: var(--dli); }
The current version of xml2rfc generates definition lists with an per-element override on every
<dd>
item that is set to 0.5em times the value of theindent
attribute on the<dl>
. Aside from being repetitious, this presents a challenge for styling of these elements.It is possible to produce a style rule that correctly styles definition lists without this. That rule looks like:
In markup, this would only involve propagating the XML
indent
attribute onto the HTML.The CSS style rule is not well supported in browsers, so it is probably necessary to manually expand the rule like this for now:
Even with a lot of these, this is more efficient than the current approach once you have a few definition lists. Importantly, it doesn't override styling. Restyling lists with per-element
style
attributes is quite difficult.Note: I've used
ch
units here, which aren't quite an en-width, but there is no equivalent in CSS. Either way, an en-width is not half of an em-width, so usingch
is a better fit.