首页 > 解决方案 > Ionic 4,如何降低ionic-segment-button的高度

问题描述

我有以下可滚动段的代码:

<ion-segment mode="md" scrollable >
  <ion-segment-button mode="md" *ngFor="let category of categories" value={{category}} (click)="FilterCateg(category)" >
    {{ category }}
  </ion-segment-button>
</ion-segment>

我怎样才能改变height. ion-segment/ ion-segment-button目前默认为50px. 我试过设置heightCSS没有效果。找到SASS variables $segment-button-md-height and $segment-button-md-line-height但找不到它们的等价物Ionic 4

标签: cssionic-frameworkionic4

解决方案


页面.scss

ion-segment-button- 正在min-height 50px接受md mode default

height只在你的按钮中给出然后只有2px高度减少因为min-height50px默认的,

并且您min-height仅在按钮中使用,然后高度没有变化

所以使用heightmin-height两者

下面给出的例子:

ion-segment-button{
    min-height: 30px; //Depends on you
    height: 30px; //Depends on you
}

推荐阅读