【问题标题】:Reduce the gap between cards - Ionic2减少卡之间的差距 - Ionic2
【发布时间】:2017-03-14 04:48:32
【问题描述】:

你能告诉我如何减少卡片之间的差距吗?我试过margin-bottom,但它不起作用。

Plunker: Ionic2 Plunk

注意:请查看home.html

我希望它是:

.sass

page-event-schedule {
   .gray {
        background-color: #f5f5f0;
    }
    ion-card {
        margin-top: 5px;
        margin-bottom: 5px;
    }
    ion-label {
        margin: 0;
    }
}

【问题讨论】:

    标签: css ionic-framework sass ionic2


    【解决方案1】:

    您可以找到更新后的 plnker here。我刚刚删除了每个ion-item的html中硬编码的margin-top:-25px;样式规则,并添加了

    ion-card {
      margin-top: 5px;
      margin-bottom: 5px;
    }
    
    ion-label {
      margin: 0;
    }
    

    【讨论】:

    • 当我将它添加到.sass 文件时,它无法正常工作。你知道为什么吗?请查看更新。
    • 当我使用 !important 时,它正在工作。非常感谢 :)
    • 如果你愿意,你可以尝试使用 .ios, .md { page-event-schedule { ... } } 这样的东西,而不是使用重要的东西,这样你的样式将比 Ionic 默认样式具有更高的优先级。
    • 感谢您的提示 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-07-16
    • 1970-01-01
    • 2014-04-27
    • 2019-06-24
    • 2013-11-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多