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
  • 19,460
  • 23
  • 103
  • 133
Tyler
  • 99
  • 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-
  • 209,133
  • 54
  • 439
  • 449