这篇翻译不完整。请帮忙从英语翻译这篇文章

摘要

:optional CSS 伪类 表示任意没有required属性的 <input><select> 或  <textarea> 元素使用它。

/* Selects any optional <input> */
input:optional {
  border: 1px dashed black;
}

它允许表单容易的展示可选字段并且渲染其外观。

注:为必填字段设置外观,请使用 :required伪类。

语法

:optional

例子

查看:invalid 示例。

规范

Specification Status Comment
HTML Living Standard
:optional
Living Standard No change.
HTML5
:optional
Recommendation Defines the semantic regarding HTML and constraint validation.
Selectors Level 4
:optional
Working Draft No change.
CSS Basic User Interface Module Level 3
:optional
Recommendation Defines the pseudo-class, but not the associated semantic.

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 10.0 4.0 (2) 10 10.0 5.0
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? 4.0 (2) 未实现 10.0 5.0

参见

文档标签和贡献者

此页面的贡献者: maoyumaoxun, liyongleihf2006
最后编辑者: maoyumaoxun,