我有一个带有背景图像的 div 元素,我想在双击它时停止在 div 元素上突出显示。是否有用于此的 CSS 属性?
最佳答案
下面的 CSS 阻止用户选择文本。现场示例:http://jsfiddle.net/hGTwu/20/
/* If you want to implement it in very old browser-versions */
-webkit-user-select: none; /* Chrome/Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */
/* The rule below is not implemented in browsers yet */
-o-user-select: none;
/* The rule below is implemented in most browsers by now */
user-select: none;
要向下定位 IE9 和 Opera,必须改用 HTML 属性 unselectable
:
<div unselectable="on">Test Text</div>
关于css - 双击时如何停止突出显示div元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7018324/