更改 Angular Material Design 标签文本的颜色(Angular 1.3.0 & ngMaterial 0.11) [英] Change the color for the Angular Material Design label text (Angular 1.3.0 & ngMaterial 0.11)

查看:35
本文介绍了更改 Angular Material Design 标签文本的颜色(Angular 1.3.0 & ngMaterial 0.11)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置了一个使用 Angular Material (v10.1) 的 AngularJS 应用程序 (1.3) - 当我点击一个输入字段(例如它处于焦点)设置为使用 Material Design 时,标签文本会更改为默认值蓝色 - 我想将其更改为我选择的颜色,这是最好的方法.

I have a setup an AngularJS app (1.3) with Angular Material (v10.1) - when I click into a input field (eg it is in focus) that is setup to use Material Design the label text changes to the default colour of blue - I want to change this to a color of my choice how is the best way to do this.

<md-input-container class="md-block">
  <label>Name</label>
  <input required>
</md-input-container>

一旦我关注标签上方的输入字段,就会将文本名称"的颜色更改为蓝色 - 在 Material Design 中将其更改为另一种颜色的推荐方法是什么?

Once I focus on the input field above the label changes the colour of the text 'Name' to blue - what is the recommended way to change this to another colour in Material Design?

推荐答案

默认状态选择器

md-input-container:not(.md-input-invalid).md-input-has-value label {
      color: #000; // your color here
}

专注状态

md-input-container:not(.md-input-invalid).md-input-focused label {
      color: #000; // your color here
}

这篇关于更改 Angular Material Design 标签文本的颜色(Angular 1.3.0 &amp; ngMaterial 0.11)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆