Html 更改 textarea 的占位符文本颜色

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43793639/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 14:37:51  来源:igfitidea点击:

change placeholder text color of textarea

htmlcss

提问by Tyler Zika

I know there is thispost on changing the placeholder text. I've tried implementing in on my textarea tags

我知道有这个职位上改变占位符文本。我试过在我的 textarea 标签上实现

textarea::-webkit-input-placeholder {
color: #fff;
}

textarea:-moz-placeholder { /* Firefox 18- */
color: #fff;  
}

textarea::-moz-placeholder {  /* Firefox 19+ */
color: #fff;  
}

textarea:-ms-input-placeholder {
color: #fff;  
}

but it's not doing anything. What am I missing?

但它没有做任何事情。我错过了什么?

This is what one of my textarea's looks like

这是我的一个textarea的样子

<textarea
  onChange={(e) => this.props.handleUpdateQuestion(e, firstQuestion.Id)}
  placeholder="Overall Satisfaction Question"
  name="SEO__Question__c"
  type="text"
  className="slds-input"
  value={firstQuestion.SEO__Question__c ? firstQuestion.SEO__Question__c : ''}
  style={inputStyle}
  autoFocus
/>

回答by Roko C. Buljan

Wrap in quotes:

用引号括起来:

onchange="{(e) => this.props.handleUpdateQuestion(e, firstQuestion.Id)}"

otherwise, it should work just fine:

否则,它应该可以正常工作:

textarea::-webkit-input-placeholder {
  color: #0bf;
}

textarea:-moz-placeholder { /* Firefox 18- */
  color: #0bf;  
}

textarea::-moz-placeholder {  /* Firefox 19+ */
  color: #0bf;  
}

textarea:-ms-input-placeholder {
  color: #0bf;  
}

textarea::placeholder {
  color: #0bf;  
}
<textarea placeholder="test"></textarea>

回答by José Jesús Ochoa Torres

I am not sure but I think is not necessary to use the prefixes right now.

我不确定,但我认为现在没有必要使用前缀。

textarea::placeholder {
  color: #fff;  
}

回答by Monyane Ramollo

textarea::placeholder {color: #fff;}

textarea::placeholder {颜色:#fff;}

回答by ZiaUllahZia

::-webkit-input-placeholder {
       color: orange;
    }
    :-moz-placeholder { /* Upto Firefox 18, Deprecated in Firefox 19  */
       color: orange;  
    }
    ::-moz-placeholder {  /* Firefox 19+ */
       color: orange;  
    }
    :-ms-input-placeholder {  
       color: orange;  
    }