Men*_*eng 5 css angular-material angular angular-material-6
这是我当前的代码:
的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>
Run Code Online (Sandbox Code Playgroud)
我的清单:
export const my_list: string[] = [ "a", "b", "c", "d"];
Run Code Online (Sandbox Code Playgroud)
style.css:
.mat-select-panel{
margin-left: 15px;
margin-top: 28px;
}
Run Code Online (Sandbox Code Playgroud)
对于那些仍然试图在不使实际选择更小或更宽的情况下弄清楚的人。
mat-select-panel 使用 100% 的 mat-select 宽度加上 32px
min-width: calc(100% + 32px)
Run Code Online (Sandbox Code Playgroud)
您可以使用 ng-deep 覆盖此样式:
::ng-deep .mat-select-panel {
min-width: 100% !important;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3464 次 |
| 最近记录: |