While using CSS columns, image bullets show partly in both columns. Any ideas how to get the bullet images to stay in their own column when columns break?
Tried some answers on other stack overflow questions and none of these worked.
-webkit-column-break-inside: avoid;
page-break-inside: avoid;
break-inside: avoid;
column-break-inside: avoid;
The only way I could get it to work correctly was to either decrease the size of the image or increase the margin between the li elements. I need the bullets to be this size (width: 42px, height: 40px) to match the comps from the designer.
Below is a simple reproduction of what I'm working on.
div {
width: 50%;
margin: 0 auto;
}
ul {
list-style-type: none;
columns: 2;
column-gap: 4rem;
line-height: 28px;
margin:0;
padding: 0;
}
li {
font-size:21px;
position: relative;
margin-bottom: 2rem;
padding-left: 4rem;
}
li::before {
content: '';
position: absolute;
width: 42px;
height: 40px;
top: 0;
left: 0;
background-image: url(https://picsum.photos/42/40);
border-radius: 50%;
background-size: contain;
background-repeat: no-repeat;
}
<div>
<ul>
<li>Airy, open floor plans</li>
<li>Sleek kitchens with stainless-steel appliances</li>
<li>Brushed-nickel finishes and plank flooring in living area</li>
<li>Carpeted bedroom</li>
<li>Individual washer and dryer</li>
<li>Exceptional Views</li>
<li>Ceramic tiled baths</li>
<li>Generous closet and storage space</li>
<li>Loft style with spiral stairs and private roof access*</li>
</ul>
</div>
Here's a link to the CodePen so you can see the results.