Andrew
Andrew

Reputation: 1277

Bullets disappear with CSS3 columns

The bullets on my list items disappear when I convert them to columns using CSS3. Any ideas why or suggestions on how to correct it?

See the example: http://jsfiddle.net/gduDm/1/

ul li {
    list-style-type: disc !important;
    column-break-inside: avoid;
}
ul {
    list-style-type: disc !important;
    margin-top: 1em;
    column-count: 2;
    column-gap: 0.5em;
}

Upvotes: 48

Views: 17907

Answers (5)

Rick Velde
Rick Velde

Reputation: 591

Some of the other solutions are pretty good, but all the ones I tried caused various side effects for me. I made some small tweaks and tried to get it as close to perfect as possible.

ul {
  column-count:2;
}

ul.solution {
  margin-left:-0.6em;
  margin-right:0.6em;
}

ul.solution > * {
  margin-left:0.6em;
  margin-right:-0.6em;
}
Experimental Group
<ul class="solution">
 <li>
  This solution is pretty similar to the others.
 </li>
 <li>
  It does not require you to put the bullets inside, so you can keep your left edge clean if you want. 
 </li>
 <li>
  This fixed it for me in IE11 while also not impacting the appearance on Chromium, so I didn't have to do any browser filtering.
 </li>
</ul>
Control Group
<ul>
 <li>
  This solution is pretty similar to the others.
 </li>
 <li>
  It does not require you to put the bullets inside, so you can keep your left edge clean if you want. 
 </li>
 <li>
  This fixed it for me in IE11 while also not impacting the appearance on Chromium, so I didn't have to do any browser filtering.
 </li>
</ul>

Upvotes: 1

Sinister Beard
Sinister Beard

Reputation: 3680

Setting margin-left:1em makes the bullets appear without messing with the text indentation.

Upvotes: 3

kjw
kjw

Reputation: 1649

After trying the first answer here, I was having issues with my list items spilling onto a second row and not lining up. Using column-gap I was able to move the second column over and see the bullets.

Source: http://karlikdesign.com/how-to-split-a-list-into-two-columns-with-pure-css/

    <!– CSS CODE –>
    .two-columns {
    -webkit-column-count: 2;
    -moz-column-count: 2;
    column-count: 2;
    -webkit-column-gap: 40px;
    column-gap: 40px;
    -moz-column-gap: 40px;
}

Upvotes: 2

Blazemonger
Blazemonger

Reputation: 92893

Adding both padding-left and a negative text-indent to the list elements seems to produce the desired result:

ul li {
    padding-left: 1em;
    text-indent: -1em;
}
ul {
    list-style: inside disc;
}

http://jsfiddle.net/mblase75/gduDm/4/

Alternatively, add a margin-left to the list element (instead of the list) and use outside bullets:

ul li {
    margin-left: 1em;
}
ul {
    list-style: outside disc;
}

http://jsfiddle.net/mblase75/gduDm/9/

Upvotes: 20

rawb
rawb

Reputation: 2426

I think the bullets are there, but they're being rendered to the left of the viewing area. Try:

list-style-position: inside;

Upvotes: 84

Related Questions