How to change the color of the text typed in the input?

Asked

Viewed 15,107 times

1

I have a input and when I type something into it the text gets the same background color(white).

Does anyone know how to edit this? I would like to put the color of text black.

  • take a look in this course, I’m sure it’ll help you a lot.

3 answers

6


Just put the attribute color as black, follows two examples of how to change the color of input,

Example: text with black color

input{
  color: black;
}
<input type="text">

Example: text with red color

input{
  color: red;
}
<input type="text">

2

Just use color in CSS:

<input type="text" style="color: black;">

2

It’s simple, just put the CSS attribute color input with the color you want. For input type text box, property color refers to the color of the text.

Something like:

input { color: white }

Or

input { color: #ffffff } /* forma pedante */

With jQuery:

$("input").css("color", "white");

You can also use more specific selectors, such as a class, or your identifier input.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.