我在angular cli项目中使用angular2-mdl (http://mseemann.io/angular2-mdl/)来设置样式。我在我的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>我想为我的标题自定义样式:我想使用自定义颜色,我想为它定义我自己的高度。
我如何才能做到这一点?我需要修改的是什么?在哪里?
注意:我不想改变整个主题,我只需要修改我的标题。
发布于 2017-09-27 22:47:20
一种方法是覆盖高度和颜色的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>发布于 2017-09-27 23:04:52
我确实覆盖了style.css文件中的原始css类,它工作得很好
https://stackoverflow.com/questions/46448345
复制相似问题