Skip to content

Instantly share code, notes, and snippets.

@zachattack
Created October 14, 2016 19:48
Show Gist options
  • Save zachattack/d2f5de0f18dd8b2d935b90ac34574fae to your computer and use it in GitHub Desktop.
Save zachattack/d2f5de0f18dd8b2d935b90ac34574fae to your computer and use it in GitHub Desktop.
The Pseudo Placeholder Text
/*
FROM CSS Tricks 2013
https://css-tricks.com/snippets/css/style-placeholder-text/
*/
::-webkit-input-placeholder {
color: red;
}
:-moz-placeholder { /* Firefox 18- */
color: red;
}
::-moz-placeholder { /* Firefox 19+ */
color: red;
}
:-ms-input-placeholder {
color: red;
}
/* From the comments of the same post */
input[placeholder], [placeholder], *[placeholder] {
color: blue;
}
/*
FROM IE Docs
https://msdn.microsoft.com/en-us/library/hh772745(v=vs.85).aspx
*/
input.address:-ms-input-placeholder {
font-style:italic;
color: red;
background-color: yellow;
}
/*
FROM MDN
https://developer.mozilla.org/en-US/docs/Web/CSS/:placeholder-shown
*/
:placeholder-shown {
border-color: silver;
}
/*
THE NON STANDARD?
https://developer.mozilla.org/en-US/docs/Web/CSS/::-moz-placeholder
*/
input::-moz-placeholder {
color: green;
}
/*
CSS4?
https://developer.mozilla.org/en-US/docs/Web/CSS/::placeholder
*/
input::placeholder {
color: green;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment