14

如何在材料设计中更改 md-toolbar 的高度?

http://jsfiddle.net/kostonstyle/gsroofa5/

在第一个工具栏上,我想要 30px 的高度并尝试过:

<md-toolbar style:"height: 30px;">

但它根本不起作用。我需要一个有两个块的导航栏,因为有两个工具栏。

我试试这个,但现在字母消失了。

http://jsfiddle.net/kostonstyle/r178sp9o/1/

4

5 回答 5

15

您可以使用这样的内联样式

<md-toolbar style="min-height:30px">

使用min-height使工具栏变小

于 2016-01-31T11:05:13.693 回答
9

工具栏的高度可以通过将类添加到md-toolbar.

对于中等大小的工具栏添加class="md-medium-tall"

对于大于正常添加的工具栏class="md-tall"

您还可以内联样式工具栏style="height:50px;"

于 2015-08-04T14:54:47.263 回答
8

接受的答案对我不起作用。以下是我如何在 Angular Material 应用程序中使用它:

<mat-toolbar color="primary"
     style="min-height: 30px !important; height: 30px !important;">
于 2018-08-09T04:09:31.820 回答
4

这在 Angular 8 上对我有用。将此代码放入您的 scss

.mat-toolbar {
  min-height: 50px !important; 
  height: 50px !important;
}

.mat-toolbar-row {
  min-height: 50px !important; 
  height: 50px !important;
}

用“md”替换“垫子”

于 2020-01-11T07:33:44.813 回答
1

如果只是设置min-height不起作用,就像它对我不起作用,您还必须添加max-height相同的值:

HTML

<md-toolbar class="toolbar"></md-toolbar>

CSS

.toolbar {
  max-height: 30px;
  min-height: 30px;
}
于 2018-06-13T14:30:45.477 回答