Reputation: 656
Basically I'm doing a contact form, the text input design as shown above. And the "First Name*" is a placeholder text.
Does anyone know how to change the placeholder text underline to different colour to the placeholder text.
input {
padding: 3px;
border: 1px solid #ddd;
}
input::-webkit-input-placeholder {
color: rgba(251,175,93,1);
font-weight: normal;
text-decoration: underline;
}
input::-moz-placeholder {
color: rgba(251,175,93,1);
font-weight: normal;
text-decoration: underline;
}
input:-moz-placeholder { /* Older versions of Firefox */
color: rgba(251,175,93,1);
font-weight: normal;
text-decoration: underline;
}
input:-ms-input-placeholder {
color: rgba(251,175,93,1);
font-weight: normal;
text-decoration: underline;
}
.textinput{
color: #585857;
outline: none;
width: 230px;
margin: 0 0 15px 0;
border: 1px solid #c2c2c2;
font-size: 13px;
display: block;
}
<input type="text" name="name" id="name" class="textinput" placeholder=" First Name*">
Upvotes: 1
Views: 3936
Reputation: 14187
You can use text-decoration-color css property like this :
input::-moz-input-placeholder {
font-weight: normal;
text-decoration: underline;
text-decoration-color: rgba(251,175,93,1);
}
Result :
See this fiddle for more information
Note that it will only work on :
-moz-
) - Tested-webkit-
)You can use both input-placeholder
pseudo-element and border-bottom
css property like this :
::-webkit-input-placeholder {
border-bottom: 1px solid rgba(251,175,93,1);
}
Result :
See this fiddle for more information
Note that it will only work on :
-webkit-
) - TestedUpvotes: 3
Reputation: 442
try this one it works
input {
padding: 3px;
border: 1px solid #ddd;
}
input::-webkit-input-placeholder {
color: rgba(9,0,255,1);
font-weight: normal;
text-decoration: underline;
text-decoration-color:rgba(255,60,0,1);
}
input::-moz-placeholder {
color: rgba(9,0,255,1);
font-weight: normal;
text-decoration: underline;
text-decoration-color:rgba(255,60,0,1);
}
input:-moz-placeholder { /* Older versions of Firefox */
color: rgba(9,0,255,1);
font-weight: normal;
text-decoration: underline;
text-decoration-color:rgba(255,60,0,1);
}
input:-ms-input-placeholder {
color: rgba(9,0,255,1);
font-weight: normal;
text-decoration: underline;
text-decoration-color:rgba(255,60,0,1);
}
.textinput{
color: black;
outline: none;
width: 230px;
margin: 0 0 15px 0;
border: 1px solid black;
font-size: 13px;
display: block;
}
Upvotes: 0