MD-自动完成的占位符文本更改CSS [英] Change css of placeholder text of md-autocomplete

查看:383
本文介绍了MD-自动完成的占位符文本更改CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用角料1.1版

我想改变MD-自动完成组件的占位符文本的样式。但是,我不能选择占位符与它的造型来扮演分开的元素。

I want to change the style of placeholder text of md-autocomplete component. However, i could not select the placeholder as an apart element to play with its styling.

下面你看到一个 codePEN 来说明这个问题。

Here you see a codepen to illustrate the problem.

我尝试以下口述codeS,但他们没有工作。

I tried the following dictating codes but they did not work

md-autocomplete{
  color: red !important;
}
md-autocomplete-wrap{
  color: red !important;
}
input{
  color: red !important;
}

有没有办法做到这一点?

Is there any way to do it?

推荐答案

要改变一个元素中的占位符,伪元素占位符应该是用户。

To change the placeholders within an element, the pseudo element placeholder should be user.

在这种情况下:

md-autocomplete input::-webkit-input-placeholder {
    color:red;
}
md-autocomplete input:-moz-placeholder { /* Firefox 18- */
    color:red;
}

md-autocomplete input::-moz-placeholder {  /* Firefox 19+ */
    color:red;
}

md-autocomplete input:-ms-input-placeholder { 
    color:red;
}

如何改变

伪元素

感谢@Rayon Dabre:

Thanks to @Rayon Dabre:

这篇关于MD-自动完成的占位符文本更改CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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