Reputation: 85
Is there any trick I can make a placeholder 2 different colors, here is the code
<input type="text"
class="form-control setting-form"
id="inputDefault2"
placeholder="http://blabbr.im/#itsmynewawesomechat">
I want to give "blabbr.im/" color rgba(255,255,255,0.3) and "#itsmynewawesomechat" color rgba(255,255,255,1)...
Upvotes: 0
Views: 1086
Reputation: 1911
There is no way to style a placeholder with two different colors. As an alternative, you could style both <label>
and <input>
to look like a single <input>
(or any other tag like a <span>
).
label, input {
background-color: #4679BD;
border: 1px solid #567890;
float: left;
font-family: sans-serif;
font-size: 14px;
line-height: 1.4;
padding: 2px 5px;
}
label {
border-radius: 2px 0 0 2px;
border-right: 0;
color: rgba(255,255,255,0.3);
padding-right: 0;
}
input {
border-radius: 0 2px 2px 0;
border-left: 0;
}
::-webkit-input-placeholder {
color: rgba(255,255,255,1);
}
:-moz-placeholder {
color: rgba(255,255,255,1);
}
::-moz-placeholder {
color: rgba(255,255,255,1);
}
:-ms-input-placeholder {
color: rgba(255,255,255,1);
}
<div>
<label for="hashtag">http://blabbr.im/</label>
<input id="hashtag" type="text" placeholder="#itsmynewawesomechat"/>
</div>
Upvotes: 1
Reputation: 1877
to change placeholder style you can use:
::-webkit-input-placeholder {
color: red;
}
:-moz-placeholder { /* Firefox 18- */
color: red;
}
::-moz-placeholder { /* Firefox 19+ */
color: red;
}
:-ms-input-placeholder {
color: red;
}
you can use the id or nth-child() to target your second input
Upvotes: 0