Bullets disappear with CSS3 columns

2019-01-18 00:53发布

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;
}

4条回答
beautiful°
2楼-- · 2019-01-18 01:35

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;
}
查看更多
Juvenile、少年°
3楼-- · 2019-01-18 01:39

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

list-style-position: inside;
查看更多
三岁会撩人
4楼-- · 2019-01-18 01:41

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

查看更多
你好瞎i
5楼-- · 2019-01-18 01:58

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/

查看更多
登录 后发表回答