Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi-column definition list

I have a <dl> like so:

<dl>
<dt id="a_1">Quantity:
<dd id="a_2">
<dt id="b_1">Size:
<dd id="b_2">
<dt id="c_1">Rise:
<dd id="c_2">
<dt id="d_1">Color:
<dd id="d_2">
....
</dl>

This list is generated dynamically through php. I have a container of a certain height. What is the best way to make this list into two columns when it gets too large? If possible, I would like to keep it as a dl though it's not absolutely necessary.

If it helps at all, I'm using bootstrap.

like image 754
Falantar014 Avatar asked Apr 19 '13 17:04

Falantar014


Video Answer


1 Answers

The most elegant way would be to use the CSS columns properties:

http://codepen.io/cimmanon/pen/tcyHv

dl {
  columns: 2;
}

dd {
  break-before: avoid;
}

Support for it is fairly good, but Firefox doesn't honor the break-before property (which is being used to prevent the definition from ending up in a different column from its term). Adding prefixes may be necessary.

http://caniuse.com/#feat=multicolumn

like image 76
cimmanon Avatar answered Nov 02 '22 06:11

cimmanon