我想在 input
元素中设置用户输入的样式,但我似乎找不到适合它的(伪)类。要清除它:这不是我想要设置样式的 placeholder
,可以这样做。
input {
background-color: white;
}
input::placeholder {
color: blue;
}
input:active, input:focus {
color: red;
}
input:pseudo_class? { // When the user leaves the input, styling the text.
color: black;
}
<div class="form-group">
<input type="email" class="form-control" id="inputEmail" placeholder="Subscribe to our News Letter">
</div>
最佳答案
只需在input
中设置color:black
input {
background-color: white;
color: black
}
input::placeholder {
color: blue;
}
input:active,
input:focus {
color: red;
}
<div class="form-group">
<input type="email" class="form-control" id="inputEmail" placeholder="Subscribe to our News Letter">
</div>
关于html - 如何在用户离开输入后设置输入样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47770449/