search

Home  >  Q&A  >  body text

css - 列表li与li之间的间距怎么设置?


如上图所示,这个是使用appcan开发的移动app, 图中的li是使用Listview列表组件写的,代码如下:

<p id="listview">  </p>

var updateData = [{
            title : "上海教育体系被赞世界最强之一教师是教育质 量的核心",
            note : "2016-01-01",
            icon : "img/icon_01.png"
        }, {
            title : "上海教育体系被赞世界最强之一教师是教育质 量的核心",
            note : "2016-01-01",
            icon : "img/icon_02.png"
        }];
        var lv1 = appcan.listview({
            selector : "#listview",
            type : "thickLine",
            hasIcon : true,
            hasAngle : false
        });
        lv1.set(updateData);

这个列表加了margin来设置li与li之间的间距,不起作用。

要达到如下图所示的效果,ulbackground-color是灰色的,libackground-color是白色的,li是有边框的, 上个li的下边框与下个li的上边框 之间是有空隙的。

请问,如何用css设置这种 lili 边框 之间的空隙?

天蓬老师天蓬老师2780 days ago2100

reply all(5)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 14:43:22

    I found the cause of the problem. It’s not that margin doesn’t work, but that background-color:#fff is written incorrectly, and ul also has a white background
    -_-||| @_@

    Thank you all for your responses. . .

    ps: It took a long time to make trouble but it was an own mistake. . . I really want to find a crack in the ground and crawl into it. . . Cover your face. . . .

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 14:43:22

    Margin is the outer margin. Isn’t this enough?

    This is no problem either

    Looked at the one downstairs. I’ll post another padding for you

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 14:43:22

    Can’t I just set the margin of the middle li?

    reply
    0
  • 迷茫

    迷茫2017-04-17 14:43:22

    https://jsfiddle.net/n60rkeka/1/

    reply
    0
  • PHPz

    PHPz2017-04-17 14:43:22

    Just set margin. But you haven’t adopted the above answer. Is it because you don’t understand your needs and how to get it?

    reply
    0
  • Cancelreply