3

I have a script that erases the default value text in the form when the user clicks in the field, but how can I make the value text appear in italics? If I change the input in my css to font-style:italic then when the user types it appears in italics too and I just want the "preview text" to be in italics and then normal when the user is typing.

http://tylerbrockphotography.com/contact1.php

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
Tyler
  • 109
  • 1
  • 4
  • 8

1 Answers1

10

You need to use a different selector for each engine, unfortunately.

#box::-webkit-input-placeholder { font-style: italic; }
#box::-ms-input-placeholder { font-style: italic; }
#box::-moz-placeholder { font-style: italic; }

Here’s a demo!

Ry-
  • 218,210
  • 55
  • 464
  • 476