首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >angular2-mdl更改标题颜色和高度

angular2-mdl更改标题颜色和高度
EN

Stack Overflow用户
提问于 2017-09-27 20:49:40
回答 2查看 342关注 0票数 0

我在angular cli项目中使用angular2-mdl (http://mseemann.io/angular2-mdl/)来设置样式。我在我的index.html中添加了默认的css

代码语言:javascript
复制
<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">

我定义头部和导航的主要内容:

代码语言:javascript
复制
<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>

我想为我的标题自定义样式:我想使用自定义颜色,我想为它定义我自己的高度。

我如何才能做到这一点?我需要修改的是什么?在哪里?

注意:我不想改变整个主题,我只需要修改我的标题。

EN

回答 2

Stack Overflow用户

发布于 2017-09-27 22:47:20

一种方法是覆盖高度和颜色的mdl-layout-header。因此,向其添加自定义类,并覆盖其css

代码语言:javascript
复制
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)

代码语言:javascript
复制
<mdl-layout-header class="custom">
   <mdl-layout-header-row>
      ...
      ...
      ...
   </mdl-layout-header-row>
</mdl-layout-header>
票数 1
EN

Stack Overflow用户

发布于 2017-09-27 23:04:52

我确实覆盖了style.css文件中的原始css类,它工作得很好

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46448345

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档