【发布时间】:2021-02-09 03:01:00
【问题描述】:
我有一个带有标签的输入字段:autocomplete="on" 和 value=""。当我返回并再次访问该站点时,值在字段中,但不在 值标签 中。
我的 HTML 代码:
<div class="inputBox">
<input type="email" name="email" autocomplete="on" onkeyup="this.setAttribute('value', this.value);" required value="">
<label>E-Mail</label>
</div><br>
我的 CSS(我不确定你是否需要它):
.inputBox input:focus ~ label,
.inputBox input:valid ~ label,
.inputBox input:not([value=""]) ~ label {
/*My Style*/
}
Example Image (Right of the required is value)
请随时向我询问更多详情。
【问题讨论】:
标签: html css forms validation input