PDA

View Full Version : Adding CSS to fields


gigiloumill
07-08-2010, 12:53 PM
Guys, does anyone know how to add CSS to fields. I've set a contact form and I'm inputting the title of the info I would like to collect inside the field. I would like to change the font and size. Thanks

Corrosive
07-08-2010, 01:12 PM
You can set styles for input tags using CSS or target individual ones with a class or ID.

gigiloumill
07-08-2010, 04:55 PM
Thanks C. Now, how can I make title inside tag to disappear when user clicks inside it.

Corrosive
07-08-2010, 04:58 PM
If I understand what you mean then give it an initial value;

<input name="??" type="text" value="Start Typing Here">

Unless I have misunderstood??

gigiloumill
07-08-2010, 05:07 PM
That I got. But, it still doesn't make word disappear when clicked inside field. I would have to back space...

Corrosive
07-08-2010, 05:34 PM
Oh sorry, yes. I see what you mean. Just use some nifty javascript;

<input onfocus="this.value=''" name="??" type="text" value="Start Typing Here" >

gigiloumill
07-09-2010, 12:46 AM
Thanks C. It's perfect. One last question: How can I use the last java code to make a text area. I can't seem to figure it out. Thanks, again..

Corrosive
07-09-2010, 09:22 AM
Does it not work in the same way?

gigiloumill
07-09-2010, 11:36 AM
It shows as a regular field. I need to use as a text field for user to leave messages.. Thanks

Corrosive
07-09-2010, 12:31 PM
You need to use text area; http://www.w3schools.com/tags/tag_textarea.asp