Set HTML5 Input’s Placeholder Style with CSS

With the HTML placeholder attribute, we can specify helper text for our input, textarea or select. This is a useful method for giving additional information to our user but don’t forget to use labels too.

The placeholder disappears by default so if the input is on focus the user doesn’t know any information (if no label is present).

If you are working with Sass (or any preprocessor), you can make a custom mixin.

Note you must separate the selector because if you group it, an invalid one will cause ignore the whole group.

See the Pen Set HTML5 Input’s Placeholder Style with CSS by Adam Laki (@adamlaki) on CodePen.