- Be careful to avoid bad contrasts. Firefox's placeholder appears to be defaulting with a reduced opacity, so needs to use
opacity: 1
here. - Note that placeholder text is just cut off if it doesn’t fit – size your input elements in
em
and test them with big minimum font size settings. Don’t forget translations: some languages need more room for the same word. - Browsers with HTML support for
placeholder
but without CSS support for that (like Opera) should be tested too. - Placeholders are no replacement for labels, so make sure you have a label, too
- Some browsers use additional default CSS for some
input
types (email
,search
). These might affect the rendering in unexpected ways. Use the properties-webkit-appearance
and-moz-appearance
to change that. Example:
hitautodestruct
- 20.5k
- 13
- 72
- 94
hitautodestruct
- 20.5k
- 13
- 72
- 94
separated the references from the actual pseudo classes codes so that it will be easier for developers/readers to copy-paste the presented pseudo classes; Also, rewrote a link text
Abel Callejo
- 14.5k
- 10
- 72
- 91
separated the references from the actual pseudo classes codes so that it will be easier for developers/readers to copy-paste the presented pseudo classes; Also, rewrote a link text
Abel Callejo
- 14.5k
- 10
- 72
- 91
mnsth
- 2.3k
- 1
- 19
- 22
Microsoft Edge is tested - :-ms-input-placeholder does not work, ::-webkit-input-placeholder does. Microsoft Edge has switched to ::-webkit-input-placeholder
mnsth
- 2.3k
- 1
- 19
- 22
jonathancardoso
- 12.5k
- 7
- 54
- 72
Felix Rabe
- 4.3k
- 4
- 26
- 34
Fixed a typo where it said "double colon". One double-colon would be two colons. A colon is :. If it was a double anything, it'd be a double-period.
Kevin Ghadyani
- 7.1k
- 8
- 44
- 65
Sk8erPeter
- 6.9k
- 9
- 49
- 67