Reputation: 129
How do i set the placeholder color of the active input, but that doesn't work.. I tried following:
::-webkit-input-placeholder:active {
color: blue;
}
:-moz-placeholder:active {
color: blue;
}
:-ms-input-placeholder:active {
color: blue;
}
What i am after is same effect as the inputs on https://twitter.com/ ..
Solution so far:
:focus::-webkit-input-placeholder {
color: blue;
}
:focus:-moz-placeholder {
color: blue;
}
:focus:-ms-input-placeholder {
color: blue;
}
Upvotes: 1
Views: 6921
Reputation: 2273
Is this you looking for? I am not sure...
input {
border: 1px solid black;
margin-top: 150px;
margin-left: 100px;
height: 20px;
width: 200px;
padding: 5px;
border-radius: 3px;
font-size: 14px;
transition:.2s linear;
-webkit-transition:.2s linear;
-moz-transition:.2s linear;
}
input:focus {
outline: none;
box-shadow: 0px 0px 7px #61C5FA;
border-color: #61C5FA;
}
:focus::-webkit-input-placeholder {
color: blue;
}
Change the placeholder text bluecolor into whatever you like... If, its not just explain more...
Thanks
Upvotes: 0
Reputation: 157334
You are using :active
pseudo class, instead use :focus
:active
styles only applies when you keep an element clicked
, so use :focus
for input fields...
CSS
:focus::-webkit-input-placeholder {
color: blue;
}
:-moz-placeholder:focus {
color: blue;
}
:-ms-input-placeholder:focus {
color: blue;
}
Preview
Upvotes: 3