非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。

-moz-user-focus CSS property is used to indicate whether an element can have the focus.

/* Keyword values */
-moz-user-focus: normal;
-moz-user-focus: ignore;
/* Global values */
-moz-user-focus: inherit;
-moz-user-focus: initial;
-moz-user-focus: unset;
					

By setting its value to ignore , you can disable focusing the element, which means that the user will not be able to activate the element. The element will be skipped in the tab sequence.

初始值 none
适用于 所有元素
继承 no
计算值 如指定
动画类型 discrete
注意: This property doesn't work for XUL <xul:textbox> elements, because the textbox itself never takes focus. Instead, XBL creates an anonymous HTML <input> element inside the textbox , and that element is what receives focus. You can stop the textbox from taking keyboard focus by setting its tab index to -1 , and from taking mouse focus by preventing the default action of mousedown 事件。

句法

ignore

The element does not accept the keyboard focus and will be skipped in the tab order.

normal

The element can accept the keyboard focus.

select-after

?

select-before

?

select-menu

?

select-same

?

select-all

?

none

?

形式定义

初始值 none
适用于 所有元素
继承 no
计算值 如指定
动画类型 discrete

形式句法

ignore | normal | select-after | select-before | select-menu | select-same | select-all | none
					

范例

HTML

<input class="ignored" value="The user cannot focus on this element.">
					

CSS

.ignored {
  -moz-user-focus: ignore;
}
					

规范

Not part of any standard. A similar property, user-focus , was proposed in early drafts of a predecessor of the CSS3 UI specification , but was rejected by the working group.

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
-moz-user-focus 非标 Chrome 不支持 No Edge 不支持 No Firefox 完整支持 1 IE 不支持 No Opera 不支持 No Safari 不支持 No WebView Android 不支持 No Chrome Android 不支持 No Firefox Android 完整支持 4 Opera Android 不支持 No Safari iOS 不支持 No Samsung Internet Android 不支持 No

图例

完整支持

完整支持

不支持

不支持

非标。预期跨浏览器支持较差。

非标。预期跨浏览器支持较差。

另请参阅

元数据

  • 最后修改: