Changing default css in Angular Material for md-input

99封情书 提交于 2019-12-05 13:40:32

You can use this selector to change the input:

md-input-container:not(.md-input-invalid).md-input-focused .md-input {
    border-color: red
}

Use this to change the label:

md-input-container:not(.md-input-invalid).md-input-focused label {
    color: red
}

Include this after you include the css for angular material.

I got this by going to the docs page here: https://material.angularjs.org/latest/demo/input

Looking at their demo, and inspecting a focused input.

You can also use <md-input-container [dividerColor]="primary|accent|warn"> to set the color when the field is in focus.

From the docs...

The divider (line under the input content) color can be changed by using the dividerColor attribute of md-input-container. A value of primary is the default and will correspond to the theme primary color. Alternatively, accent or warn can be specified to use the theme's accent or warn color.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!