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? Quote Link to comment Share on other sites More sharing options...
isedeasy Posted November 11, 2009 Share Posted November 11, 2009 textarea { color:#000; } textarea:focus { color:#f00; } Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.