[英]angular2-mdl change header color and height
我正在使用angular2-mdl( http://mseemann.io/angular2-mdl/ )在我的angular cli项目中进行样式设置。 我在我的index.html中添加了默认的CSS作为
<link rel="stylesheet" href="https://code.getmdl.io/1.1.3/material.indigo-pink.min.css" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet">
我定义标题和导航的主要内容:
<div class="demo-container" mdl-shadow="2">
<mdl-layout mdl-layout-fixed-header mdl-layout-header-seamed>
<mdl-layout-header>
<mdl-layout-header-row>
<mdl-layout-title>AMM</mdl-layout-title>
<mdl-layout-spacer></mdl-layout-spacer>
<!-- Navigation. We hide it in small screens. -->
<nav class="mdl-navigation">
<!-- logout -->
<button mdl-button mdl-button mdl-button-type="icon" (click)="logout()">
<mdl-icon>exit_to_app</mdl-icon>
</button>
</nav>
</mdl-layout-header-row>
</mdl-layout-header>
<mdl-layout-content>
<!-- Your content goes here -->
<div class="mdl-grid">
</div>
</mdl-layout-content>
</mdl-layout>
</div>
我想为标题设置自定义样式:我想使用自定义颜色,并为其定义自己的高度。
我该如何实现? 我必须在什么地方修改?
注意:我不想更改整个主题,我只需要修改标题即可。
一种方法是覆盖高度和颜色的mdl-layout-header
。 因此,向其添加一个自定义类,并覆盖其CSS
mdl-layout-header.custom{
min-height: 30px; //change this value for height
height: 30px;
background-color: red; // change this for color
}
mdl-layout-header.custom mdl-layout-header-row{
height: inherit;
}
导航栏代码(html)
<mdl-layout-header class="custom">
<mdl-layout-header-row>
...
...
...
</mdl-layout-header-row>
</mdl-layout-header>
我确实在style.css文件中覆盖了原始的CSS类,效果很好
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.