CSS3 columns cutting off <li>s

徘徊边缘 提交于 2019-12-05 15:40:48
Lucía Amado

This thread is a bit old, but I had the same issue recently and used this to prevent the list items from getting cut:

li {
-webkit-column-break-inside: avoid;
          page-break-inside: avoid;
               break-inside: avoid;
}

More info on CSS-Tricks

Hope it helps anyone in the same boat!

It seems to be linked to margins on li elements and ol. From jsfiddle.net/nZUB9 I reseted your CSS at first and then turn margin: 6px 0; into padding: 6px 0; It did the job for me ;)

/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}


* {
margin: 0;
padding: 0;
font-family: arial, verdana;
}

.task-wrapper {
-moz-column-width: 310px;
-moz-column-gap: 10px;
-webkit-column-width: 310px;
-webkit-column-gap: 10px;
column-width: 310px;
column-gap: 10px;
    border:1px solid red;
}

ol.tasks {
list-style-type: none;
margin-left: 0;
    display: block;
}

ol.tasks li {
border-bottom: 1px dotted rgba(0, 30, 30, 0.3);
background-color: white;
background-color: rgba(255, 255, 255, 0.9);
}

ol.tasks li {
border: 1px solid rgba(0, 30, 30, 0.3);
padding: 6px 0;
list-style-type: decimal;
width: 310px;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!