更改文本区域的占位符文本颜色

问题描述 投票:21回答:4

我知道关于更改占位符文本的this帖子。我尝试在自己的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;  
}

但是它什么也没做。我想念什么?

这是我的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
/>
html css
4个回答
30
投票

用引号引起来:

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

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

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>

12
投票

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

textarea::placeholder {
  color: #fff;  
}

1
投票

textarea ::占位符{color:#fff;}


0
投票
::-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;  
    }
© www.soinside.com 2019 - 2024. All rights reserved.