CSS

ime 样式 | ime-mode

ime-mode

ime-mode属性控制文本字段的输入方法编辑器的状态。

ime-mode: auto; ime-mode: normal; ime-mode: active; ime-mode: inactive; ime-mode: disabled; /* Global values */ ime-mode: inherit; ime-mode: initial; ime-mode: unset;

根据规范:

“ime-mode”是在某些浏览器中实现的一个属性,这是有问题的,并且被这个规范淘汰了

用户代理被规范指示为不支持,ime-mode并且作者建议不要使用它,除非如果先前由遗留代码设置,则撤消该属性。它是由Microsoft以Internet Explorer 5作为专有扩展引入的:-ms-ime-mode Attribute | imeMode属性(http://msdn.microsoft.com/library/ms530767(VS.85%29.aspx)

初始值auto
适用元素text fields
是否是继承属性no
适用媒体interactive
计算值as specified
Animation typediscrete
正规顺序the unique non-ambiguous order defined by the formal grammar

语法

下面列出的关键字值之一。

auto不改变输入法状态,此为预设值。

注:通常,公共网站不适合更改IME模式。此属性只能被私有或内部web程序使用。

正式语法

auto | normal | active | inactive | disabled

示例

<input type="text" name="name" value="initial value" style="ime-mode: disabled">

此范例在输入栏位中设定为停用输入法,在后端资料库不支援扩充字元集、却必须让使用者自行输入文字时,可以使用。

注意:不要依赖禁用IME来防止扩展字符通过您的表单。即使禁用了IME,用户仍然可以将扩展字符粘贴到表单的字段中。

备注

与Internet Explorer不同的地方是,Firefox实作ime-mode时亦允许此特性套用至密码输入栏位,但这在理想的使用体验上有不妥之处、而密码栏位也应该停用输入法。若有网站执意将不适切的行为套用至密码栏位,则使用者可以在自订CSS档中加上下列设定以强迫调整此功能:

input[type=password] { ime-mode: auto !important; }

Mac版的Gecko 1.9中,若某栏位设定停用输入法,则自该栏位移开输入焦点时并无法自行恢复输入法状态,所以若使用disabled值,Mac的使用者可能会碰上麻烦。

规范

SpecificationStatusComment
CSS Basic User Interface Module Level 3The definition of 'ime-mode' in that specification.Candidate RecommendationInitial definition

浏览器兼容性

FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic supportNo support(Yes)3.0 (1.9)5.0 1No supportNo support

FeatureAndroidEdgeFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support?(Yes)????