1

I'm trying to change the font color of the placeholder text that appears in the input boxes before the visitor types any text.

Here's my example http://santa.parseapp.com/

See the text boxes at the bottom of the page. I think it's using a user agent stylesheet at the moment, which means the form elements dont have styles created?

I'm not sure which element I need to target with CSS. Here's what I've go:

form input[type=text] {
  width: 300px;
  margin-bottom: 7px;
  font-size: 20px;
  border: 0;
  padding: 5px 7px;
  background-color: #FF2950;
  color: #fff;
  }
2
  • Show what you have tried Commented Nov 30, 2013 at 10:09
  • I've added the code where the input box is. Commented Nov 30, 2013 at 10:14

2 Answers 2

2

It sounds like you're looking to style the placeholder text, yeah?

Generally speaking, placeholder text gets the same styling as the element itself, apart from the colour. So in your example, the placeholder text will be color: grey and font-size: 20px.

If you want to target the placeholder text specifically, you need to use the :placeholder psuedo-class:

::-webkit-input-placeholder {
   color: blue;
}

::-moz-placeholder {
   color: blue;
}

:-ms-input-placeholder {  
   color: blue;
}
Sign up to request clarification or add additional context in comments.

1 Comment

I appreciate the constructive help.
0

Check this fiddle:

http://jsfiddle.net/7r2d9/1/

form input[type=text]:focus {
  color: black;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.