mai*_*idi 4 css angular-material flexboxgrid angular
我有一个带有6个按钮切换的mat-button-toggle-group。在桌面上,所有按钮都应该在一行中。在较小的屏幕上,组应断开并显示2行按钮,如下所示:

到目前为止,这是我的代码(我正在使用flexbox-grid):
<mat-button-toggle-group class="col-xs-12"
<mat-button-toggle class="col-xs-4 col-lg-2" value="1">1 Monat</mat-button-toggle>
<mat-button-toggle class="col-xs-4 col-lg-2" value="3">3 Monate</mat-button-toggle>
<mat-button-toggle class="col-xs-4 col-lg-2" value="6">6 Monate</mat-button-toggle>
<mat-button-toggle class="col-xs-4 col-lg-2" value="12">1 Jahr</mat-button-toggle>
<mat-button-toggle class="col-xs-4 col-lg-2" value="60">5 Jahre</mat-button-toggle>
<mat-button-toggle class="col-xs-4 col-lg-2" value="120">10 Jahre</mat-button-toggle>
</mat-button-toggle-group>
Run Code Online (Sandbox Code Playgroud)
如果在台式机上工作正常,但在移动屏幕尺寸上,则只有3个按钮可见(第二行应显示的三个按钮不可见):

如何使我的mat-button-toggle-group分成两行?
小智 5
您必须将toggle-group元素的flex-wrap属性设置wrap为:
mat-button-toggle-group {
flex-wrap: wrap;
}
Run Code Online (Sandbox Code Playgroud)
然后,只需根据需要固定边界即可。
| 归档时间: |
|
| 查看次数: |
1537 次 |
| 最近记录: |