CSS 3.0 user-select property replacement

谁说胖子不能爱 提交于 2019-12-13 12:58:53

问题


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?


回答1:


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.

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;
}

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.

See my answer on disabling text selection is not working in IE using jquery.



来源:https://stackoverflow.com/questions/8152526/css-3-0-user-select-property-replacement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!