Skip to content
← Back to blog
·1 min read

How to format an HTML input field with CSS

uiweb

A plain HTML field is autostyled by the browser, With this CSS you can spice up a little bit the desing. Some CSS selectors, in this case, depends on the browser you are working with. Let's hope that in a few years we can have a more standard web so we avoid coding for each vendor.

/* for chrome/safari */
input::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
  font-style:italic;        
  color: #AAAAAA;
}
/* for firefox */
input:-moz-placeholder, textarea:-moz-placeholder {
  font-style:italic;        
  color: #AAAAAA;
}
/* for internet explorer */
input:-ms-input-placeholder, textarea:-ms-input-placeholder {
  font-style:italic;        
  color: #AAAAAA;
}