ng-select - 改变高度

sac*_*man 6 angular-ngselect angular

我正在使用 ng-select 库https://github.com/ng-select/ 1.4.2 版的 Angular 5。我想自定义它,以便 ng-select 的高度更小。如何做到这一点?我在https://github.com/ng-select/ng-select#custom-styles 上查看了自定义样式,但无法使其正常工作。

我已经添加了一个定制的 CCS,试图做到这一点。

这是我的 ng-select 代码

                <label class="col-sm-4 text-sm-right col-form-label">Payout Format</label>
                <div class="col-sm-8">
                    <ng-select
                        [items]="payoutFormats"
                        [closeOnSelect]="true"
                        [searchable]="true"
                        bindValue="payoutBatchFormatID"
                        bindLabel="name"
                        placeholder="All"
                        [(ngModel)]="filter.payoutFormats"
                        name="payoutFormat"
                        class="custom">
                    </ng-select>
                </div>
Run Code Online (Sandbox Code Playgroud)

这是我添加的用于自定义它的 CSS:

.ng-select.custom {
    height:5px;
    font-size: 0.8em;
}

.ng-select.custom .ng-select-container  {
    height:5px;
}
Run Code Online (Sandbox Code Playgroud)

可以看出,我尝试在 2 个地方设置高度,但没有效果。我能够成功更改字体大小。

这是我的选择在 CSS 之后的样子: 在此处输入图片说明

我需要它更小。

Mai*_*jat 10

通过 CSS 覆盖样式:

.ng-select .ng-select-container {
  min-height: 20px;
}

.ng-select.ng-select-single .ng-select-container {
  height: 20px;
}
Run Code Online (Sandbox Code Playgroud)

ng-选择