khu*_*ram 5 css textbox textfield required-field
我想要文本字段中的文本,例如“你的名字*”,
“你的名字”的颜色应该是黑色,* 的颜色应该是红色。
我怎样才能做到这一点??
请帮我。
khu*_*ram -1
这就是我在这里问的问题。
多种颜色占位符。
回答链接在这里
这里有一些技巧
.input-field {
position: relative;
display: inline-block;
}
.input-field > label {
position: absolute;
left: 0.5em;
top: 50%;
margin-top: -0.5em;
opacity: 0.5;
}
.input-field > input[type=text]:focus + label {
display: none;
}
.input-field > label > span {
letter-spacing: -2px;
}
.first-letter {
color: red;
}
.second-letter {
color: blue;Run Code Online (Sandbox Code Playgroud)
<div class="input-field">
<input id="input-text-field" type="text"></input>
<label for="input-text-field">
<span class="first-letter">your name</span>
<span class="second-letter">*</span>
</label>
</div>Run Code Online (Sandbox Code Playgroud)