rss feed Twitter Page Facebook Page Github Page Stack Over Flow Page

Styling HTML5 Placeholder using CSS

One of the cool new feature in HTML5 is the placeholder. This feature allows to display any text in a form field (input and text area) and when a user focus in the field, it disappears and reappear if the field is empty. Before, if we wanted this feature, we had to create JavaScript code to manipulate and validate what the user enters and display the information.

I realized the colour is always the same, and I wanted to make it more appealing.

But how can I change it to something like this:

Every browsers use different pseudo selectors.

CSS

::-webkit-input-placeholder {
  color: #908681;
  font-size: 10px;
  text-transform:uppercase;
}
input:-moz-placeholder {
  color: #908681;
  font-size: 10px;
  text-transform:uppercase;
}
:-ms-input-placeholder {
  color: #908681;
  font-size: 10px;
  text-transform:uppercase;
}

Not all the CSS properties (link to learn css) are available for the placeholder. Keep it as simple as possible, after all it is just a label that will disappear once the user write something in these fields.