Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change placeholder text color of textarea

Tags:

html

css

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

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   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 /> 
like image 238
Tyler Zika Avatar asked May 04 '17 22:05

Tyler Zika


People also ask

How can I change placeholder color?

In most browsers, the placeholder text is grey. To change this, style the placeholder with the non-standard ::placeholder selector. Note that Firefox adds a lower opacity to the placeholder, so we use opacity: 1 to fix this.

What color should placeholder text be?

Note: In most browsers, the appearance of placeholder text is a translucent or light gray color by default.

How do you style a placeholder text?

Use the ::placeholder pseudo-element to style your placeholder text in an <input> or <textarea> form element. Most modern browsers support this, but for older browsers, vendor prefixes will be required.


2 Answers

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>
like image 92
Roko C. Buljan Avatar answered Sep 19 '22 17:09

Roko C. Buljan


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

textarea::placeholder {   color: #fff;   } 
like image 21
José Jesús Ochoa Torres Avatar answered Sep 18 '22 17:09

José Jesús Ochoa Torres