css - 双击时如何停止突出显示div元素

标签 css xhtml tags highlighting double-click

我有一个带有背景图像的 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/

相关文章:

jQuery 左右滑动 - 编写代码的更简单方法?

html - 将图像图标添加到输入标签

image - 如何使用 Powershell 为图像添加标签

javascript - 鼠标悬停时子菜单消失

html - 无法摆脱链接之间的空格

html - 使用 HTML5 移动样板 (MBP) 开发移动网站

css - xhtml anchor 链接到 div,但 div 有通用 id?

javascript - 使用Javascript引用具有相同ID的许多元素

javascript - 获取选项标签之间的文本以与 Google map 路线计算器一起使用

html - Wordpress 发布与侧边栏重叠的页面内容