CSS Input Field Text Color of Inputted Text

CSS Input field text color of inputted text

Change your second style to this:

input, select, textarea{
color: #ff0000;
}

At the moment, you are telling the form to change the text to black once the focus is off. The above remedies that.

Also, it is a good idea to place the normal state styles ahead of the :focus and :hover styles in your stylesheet. That helps prevent this problem. So

input, select, textarea{
color: #ff0000;
}

textarea:focus, input:focus {
color: #ff0000;
}

Change color of text for input field using css

Yes, it is possible.

The CSS can target the input of type "email" or just this unique input.

Email input element:

input[type=email]{
color: red;
}

Or specific id="email":

#email {
color: red;
}

Here's a snippet:

input[type=email] {

color: red;

}

#email2 {

color: green;

}
<input class="form-control ng-class:{'error':dashboard.showFormErrors && !dashboard.signinForm.email.$valid}" 

data-ng-model="signinController.signin.email"

type="email"

name="email"

id="email"

placeholder="Email"

ng-minlength="2"

ng-maxlength="3"

required>

<input class="form-control ng-class:{'error':dashboard.showFormErrors && !dashboard.signinForm.email.$valid}"

data-ng-model="signinController.signin.email"

type="email"

name="email"

id="email2"

placeholder="Email"

ng-minlength="2"

ng-maxlength="3"

required>

How to change the input field's text color in MaterializeCSS?

Simply select the input field's wrapper <div> by it's CSS class for changing the text color.

.input-field {
color:orange;
}

Fiddle: https://jsfiddle.net/Lxx2k0fq/

For changing the placeholder text color see: Change an HTML5 input's placeholder color with CSS

Concerning SASS: It looks like there is only a global text color defined in Materialize, which will by default also apply to your input fields.
In _variables.scss you can find the $off-black variable which is responsible for the color. It's applied to <html> tag and changing it will therefore change the text color of your whole page.

Input text color differs from idle color

You just need to add input[type=text] {color: white;}

* {

background: red;

}

.contact-formula {

height: auto;

width: 100%;

padding-left: 32.5%;

}

input {

width: 50%;

height: 5vh;

display: block;

background: transparent;

border: none;

border-bottom: .25vh solid orange;

}

input[type=text] {

color: white;

font-size: 3vh;

}

input[type=submit] {

width: 20%;

margin-top: 2.5vh;

text-align: center;

background: orange;

font-size: 2.5vh;

cursor: pointer;

}

textarea {

width: 50%;

background: transparent;

border: none;

border-bottom: .25vh solid orange;

resize: none;

height: 15vh;

}

label {

color: white;

font-size: 2.5vh;

}

::placeholder {

font-size: 3vh;

color: white;

text-transform: uppercase;

}

input:focus,

select:focus,

textarea:focus,

button:focus {

outline: none;

}
<div class="contact-formula">

<form name="htmlform" method="post" action="html_form_send.php">

<input type="text" name="first_name" maxlength="50" size="30" placeholder="First Name" autofocus><br>

<input type="text" name="last_name" maxlength="50" size="30" placeholder="Last Name"><br>

<input type="text" name="email" maxlength="80" size="30" placeholder="email"><br>

<textarea name="comments" maxlength="1000" cols="25" rows="6" placeholder="Message"></textarea><br>

<input type="submit" value="Submit">

</form>

</div>

Background color in input and text fields

input[type="text"], textarea {

background-color : #d1d1d1;

}

Hope that helps :)

Edit: working example, http://jsfiddle.net/C5WxK/



Related Topics



Leave a reply



Submit