CSS 3.0用户选择属性替换 [英] CSS 3.0 user-select property replacement

查看:155
本文介绍了CSS 3.0用户选择属性替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用CSS 3.0,并且抱怨用户选择"属性不存在.有谁知道合适的替代品是什么?

I am using CSS 3.0 and it is complaining that the "user-select" property doesn't exist. Does anyone know what the appropriate substitute or replacement is?

推荐答案

似乎没有一个. user-select被定义为 CSS3用户界面的一部分,后来被 CSS3基本用户界面模块取代.但是,后一文档不包含user-select的规范.经过最近的搜索,我找不到关于为何将其从规范中删除的任何讨论.

There doesn't appear to be one. user-select was defined as part of User Interface for CSS3, which was later superseded by CSS3 Basic User Interface Module. However, the latter document does not include specification of user-select. After searching recently, I was unable to find any discussion on why it might have been removed from the spec.

请注意,尽管供应商前缀版本将在Firefox,Chrome,Safari,Opera和IE 10+中运行,但user-select在任何浏览器中(我都知道)都无法使用:

Note that user-select doesn't work in any browsers (that I'm aware of), though the vendor prefixed versions will work in Firefox, Chrome, Safari, Opera and IE 10+:

#something {
    -ms-user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
}

如果仅使用这些供应商前缀,则如果将供应商扩展设置为警告,则CSS应该会验证.对于IE和Opera,可以在元素上使用unselectable属性.具有讽刺意味的是,这将使您的HTML无效.

If you use only these vendor-prefixes, your CSS should validate if you set Vendor Extensions to Warning. For IE and Opera, you can use the unselectable attribute on elements. Ironically, though, this will invalidate your HTML.

中禁用我的答案文本选择在使用jquery的IE中不起作用.

这篇关于CSS 3.0用户选择属性替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆