sciencebear Posted November 11, 2009 Share Posted November 11, 2009 In a form text area, I would like the default font to be one color, and then have the font color change when the user types. How would I go about doing this? Link to comment https://forums.phpfreaks.com/topic/181128-solved-font-color-in-forms/ Share on other sites More sharing options...
isedeasy Posted November 11, 2009 Share Posted November 11, 2009 textarea { color:#000; } textarea:focus { color:#f00; } Link to comment https://forums.phpfreaks.com/topic/181128-solved-font-color-in-forms/#findComment-955681 Share on other sites More sharing options...
sciencebear Posted November 12, 2009 Author Share Posted November 12, 2009 That works, I just can't quite seem to put it on the right element. I'm trying to apply it to tags like this (all type="text"): <form><input name="status" type="text" id="status" value="What are you up to?"/></form> I tried this: input#text{ color:#000; } input#text:focus{ color:#f00; } If I apply it to just input, it does it to all my form elements, including submit buttons. This method I though would work, but does not apply to anything. Link to comment https://forums.phpfreaks.com/topic/181128-solved-font-color-in-forms/#findComment-956124 Share on other sites More sharing options...
haku Posted November 12, 2009 Share Posted November 12, 2009 The code you are showing there is attempting to style a tag with the ID of 'text'. In CSS2, you cannot target input elements by type (it's part of the CSS3 spec). So for now, you will have to apply a class to each of your text inputs, and use that to target the inputs in question. Link to comment https://forums.phpfreaks.com/topic/181128-solved-font-color-in-forms/#findComment-956153 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.