I'm trying to create a multi column layout with css where I have a few items with headings between them. I tried to use break-after: avoid
to prevent headings from being at the bottom of a column but it doesn't seem to work
Here's a snippet that shows my Problem:
.columns-3 {
column-count: 3;
}
.column-heading {
font-weight: bold;
break-after: avoid-column;
}
<div class="columns-3">
<div class="column-heading">
Heading
</div>
<div class="column-item">
item
</div>
<div class="column-item">
item
</div>
<div class="column-item">
item
</div>
<div class="column-item">
item
</div>
<div class="column-heading">
Heading
</div>
<div class="column-item">
item
</div>
<div class="column-item">
item
</div>
<div class="column-item">
item
</div>
</div>
I also tried using avoid-column
instead of avoid
or avoiding the break on the item after the heading with
.column-heading + .column-item {
break-before: avoid;
}
Is this a bug or am I misunderstanding those properties?
Is there another way to do this with just css or do I have to do this in JS/Server code?