首页 > 解决方案 > Angular 11 Mat Select 更改选项高度打破了位置

问题描述

我有带有国家列表的垫子选择选项,类似于此处的州示例:https ://material.angular.io/components/select/overview#select-reset

is 默认包含以下css:

.mat-select-panel .mat-optgroup-label, .mat-select-panel .mat-option {
    font-size: inherit;
    line-height: 3em;
    height: 3em;
}

我想改成height: 3em;这样height: 4em;

.mat-select-panel .mat-optgroup-label, .mat-select-panel .mat-option {
        height: 4em !important;
    }

甚至添加填充中断:我假设 3em 是硬编码来计算位置的?

这会破坏所选选项,因为当我返回选择另一个选项时它不再可见。

如何在不破坏位置的情况下改变高度?

谢谢

标签: angular-materialangular11mat-select

解决方案


推荐阅读