如何在材料设计中更改 md-toolbar 的高度?
http://jsfiddle.net/kostonstyle/gsroofa5/
在第一个工具栏上,我想要 30px 的高度并尝试过:
<md-toolbar style:"height: 30px;">
但它根本不起作用。我需要一个有两个块的导航栏,因为有两个工具栏。
我试试这个,但现在字母消失了。
如何在材料设计中更改 md-toolbar 的高度?
http://jsfiddle.net/kostonstyle/gsroofa5/
在第一个工具栏上,我想要 30px 的高度并尝试过:
<md-toolbar style:"height: 30px;">
但它根本不起作用。我需要一个有两个块的导航栏,因为有两个工具栏。
我试试这个,但现在字母消失了。
您可以使用这样的内联样式
<md-toolbar style="min-height:30px">
使用min-height使工具栏变小
工具栏的高度可以通过将类添加到md-toolbar
.
对于中等大小的工具栏添加class="md-medium-tall"
对于大于正常添加的工具栏class="md-tall"
您还可以内联样式工具栏style="height:50px;"
接受的答案对我不起作用。以下是我如何在 Angular Material 应用程序中使用它:
<mat-toolbar color="primary"
style="min-height: 30px !important; height: 30px !important;">
这在 Angular 8 上对我有用。将此代码放入您的 scss
.mat-toolbar {
min-height: 50px !important;
height: 50px !important;
}
.mat-toolbar-row {
min-height: 50px !important;
height: 50px !important;
}
用“md”替换“垫子”
如果只是设置min-height
不起作用,就像它对我不起作用,您还必须添加max-height
相同的值:
HTML
<md-toolbar class="toolbar"></md-toolbar>
CSS
.toolbar {
max-height: 30px;
min-height: 30px;
}