admin管理员组文章数量:1416305
I use Angular Material version 1.1
I want to change the style of placeholder text of md-autoplete ponent. However, i could not select the placeholder as an apart element to play with its styling.
Here you see a codepen to illustrate the problem.
I tried the following dictating codes but they did not work
md-autoplete{
color: red !important;
}
md-autoplete-wrap{
color: red !important;
}
input{
color: red !important;
}
Is there any way to do it?
I use Angular Material version 1.1
I want to change the style of placeholder text of md-autoplete ponent. However, i could not select the placeholder as an apart element to play with its styling.
Here you see a codepen to illustrate the problem.
I tried the following dictating codes but they did not work
md-autoplete{
color: red !important;
}
md-autoplete-wrap{
color: red !important;
}
input{
color: red !important;
}
Is there any way to do it?
Share Improve this question asked Apr 1, 2016 at 10:58 AsqanAsqan 4,49912 gold badges63 silver badges103 bronze badges 3-
1
::-webkit-input-placeholder { color: red; }
– Rayon Commented Apr 1, 2016 at 11:03 - would it work in all browsers? and would it be valid for all input fields? – Asqan Commented Apr 1, 2016 at 11:06
- Go through the reference.. – Rayon Commented Apr 1, 2016 at 11:07
2 Answers
Reset to default 5To change the placeholders within an element, the pseudo element placeholder
should be user.
In this case:
md-autoplete input::-webkit-input-placeholder {
color:red;
}
md-autoplete input:-moz-placeholder { /* Firefox 18- */
color:red;
}
md-autoplete input::-moz-placeholder { /* Firefox 19+ */
color:red;
}
md-autoplete input:-ms-input-placeholder {
color:red;
}
How to change
Pseudo elements
Thanks to @Rayon Dabre:
You can use following selector to style the [placeholder] for different browser.
::-webkit-input-placeholder {
color: blue;
}
:-moz-placeholder { /* Firefox 18- */
color: blue;
}
::-moz-placeholder { /* Firefox 19+ */
color: blue;
}
:-ms-input-placeholder {
color: blue;
}
Example on CodePen : http://codepen.io/bigbrov/pen/LNzbqp
本文标签: javascriptChange css of placeholder text of mdautocompleteStack Overflow
版权声明:本文标题:javascript - Change css of placeholder text of md-autocomplete - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745253226a2649946.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论