Although multi-column layout as such is relatively widely supported in modern browsers, the control of column breaks is poorly implemented. Implementations mostly support just prevention of column breaks inside an element, not after or before an element. Thus, although you could in theory use break-before
or break-after
property, you need to use break-inside
in practice. (According to MDN, IE 10+ supports break-after: avoid-column
, but setting it on dt
did not seem to have any effect on IE 11.)
You cannot use anything except dt
and dd
inside a dl
. This is not just a formal rule; browsers actually enforce it, ignoring any attempts at using a wrapper around a dt
and a dd
. This is really a design flaw in the very dl
element.
Thus, what you can do is to use other markup instead of dl
, e.g.
<div class=dl>
<div class=pair>
<div class=dt>...</div>
<div class=dt>...</div>
</div>
<div class=pair>
<div class=dt>...</div>
<div class=dt>...</div>
</div>
...
</div>
You can then style it this way:
.dl {
-webkit-column-width: 20em;
-moz-column-width: 20em;
column-width: 20em;
}
.dd {
margin-left: 1em;
}
.pair {
break-inside: avoid-column;
-webkit-column-break-inside: avoid;
}
This prevents the undesired column breaks in modern versions of IE and in Chrome. I’m afraid there’s no way to make it work on Firefox.
Update: It seems that if you wrap the <div class=pair>
element inside a single-cell table, <table><tr><td><div class=pair>...</div></table>
, then Firefox does not break that element in column formatting. Perhaps the reason is that it generally tries to avoid column breaks inside a table cell, which is rather sensible.