角度材料垫 - 选择下拉宽度

问题描述 投票:3回答:1

当前下拉框的宽度大于行的宽度: enter image description here

有没有办法摆脱额外的宽度? enter image description here

这是我目前的代码:

HTML:

<mat-form-field>
    <mat-select disableOptionCentering placeholder="Choose an option">
      <mat-option [value]="option" *ngFor="let option of my_list">
          {{ option }}
      </mat-option>
    </mat-select>
</mat-form-field>

我的列表:

export const my_list: string[] = [ "a", "b", "c", "d"];

style.css中:

.mat-select-panel{
    margin-left: 15px;
    margin-top: 28px;
}
css angular angular-material angular-material-6
1个回答
1
投票

试试这个并改变宽度:

   <mat-select style="width:10px">
© www.soinside.com 2019 - 2024. All rights reserved.