Consider the following HTML:
- Number one
- Number two
&
I had the same problem i think and found a solution in this:
-webkit-column-fill: auto; /* Chrome, Safari, Opera */
-moz-column-fill: auto; /* Firefox */
column-fill: auto;
Working also in FF 38.0.5: http://jsfiddle.net/rkzj8qnv/
I made an update of the actual answer.
This seems to be working on firefox and chrome: http://jsfiddle.net/gatsbimantico/QJeB7/1/embedded/result/
.x{
columns: 5em;
-webkit-columns: 5em; /* Safari and Chrome */
-moz-columns: 5em; /* Firefox */
}
.x li{
float:left;
break-inside: avoid-column;
-webkit-column-break-inside: avoid; /* Safari and Chrome */
}
Note: The float property seems to be the one making the block behaviour.
Adding;
display: inline-block;
to the child elements will prevent them being split between columns.
In 2019, having this works for me on Chrome, Firefox and Opera (after many other unsuccessful attempts):
.content {
margin: 0;
-webkit-column-break-inside: avoid;
break-inside: avoid;
break-inside: avoid-column;
}
li {
-webkit-column-break-inside:avoid;
-moz-column-break-inside:avoid;
column-break-inside:avoid;
break-inside: avoid-column;
page-break-inside: avoid;
}
Firefox 26 seems to require
page-break-inside: avoid;
And Chrome 32 needs
-webkit-column-break-inside:avoid;
-moz-column-break-inside:avoid;
column-break-inside:avoid;
A possible workaround for Firefox is to set the CSS property "display" of the element you don't want to have a break inside to "table". I don't know if it works for the LI tag (you'll probably lose the list -item-style), but it works for the P tag.