We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
form 内置验证有一些 CSS 伪类,如 :required, :optional,:valid,:invalid,这些伪类对于突出显示用户的字段错误非常有用。
:required
:optional
:valid
:invalid
/* 匹配所有输入表单项 */ input {border: 1px solid #ccc;} /* 匹配非必填的表单项(即没有 required 属性) */ input:optional {border-color: #666;} /* 匹配必填的输入表单项 */ input:required {border-color: blue;} /* 匹配合法值的输入表单项(验证通过) */ input:valid {border-color: green;} /* 匹配非法值的输入表单项(验证未通过) */ input:invalid {border-color: red;}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
form 内置验证有一些 CSS 伪类,如
:required
,:optional
,:valid
,:invalid
,这些伪类对于突出显示用户的字段错误非常有用。The text was updated successfully, but these errors were encountered: