试一试
form.form-example {
display: table;
}
div.form-example {
display: table-row;
}
label,
input {
display: table-cell;
margin-bottom: 10px;
}
label {
padding-right: 10px;
}
可以使用 :valid 和 :invalid CSS 伪类,根据表单内的 elements 是否有效来设置
结果
技术摘要
内容类别
流式内容,可感知内容
允许内容
流式内容,但不包含