user1995822
user1995822

Reputation: 23

CSS styling placeholder text

I am trying to style placeholder text, but I can't seem to select it. If my input is this:

<input id="search" class="search-query" placeholder="Placeholder text here" name="" value"">

How can I select the placeholder text in css for styling?

Upvotes: 2

Views: 13483

Answers (1)

SeanCannon
SeanCannon

Reputation: 78006

::-webkit-input-placeholder {
   color: red;
}

:-moz-placeholder { /* Firefox 18- */
   color: red;  
}

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

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

/* All modern browsers except IE and EDGE */
::placeholder { color: red }

Demo: http://jsfiddle.net/DLGFK/

Upvotes: 15

Related Questions