如何在双击时停止高亮显示div元素? [英] how do i stop highlighting of a div element when double-clicking on?

查看:111
本文介绍了如何在双击时停止高亮显示div元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个div元素的背景图像,我想停止突出显示在div元素,当双击它。这是否有css属性?

I have this div element with a background image and i want to stop highlighting on the div element when double-clicking it. Is there a css property for this?

推荐答案

下面的CSS阻止用户选择文本。实例: http://jsfiddle.net/hGTwu/20/

The CSS below stops users from being able to select text. Live example: http://jsfiddle.net/hGTwu/20/

-webkit-user-select: none; /* Chrome/Safari */        
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */

/* Rules below not implemented in browsers yet */
-o-user-select: none;
user-select: none;

目标IE9向下和Opera的html属性 unselectable 必须改为:

To target IE9 downwards and Opera the html attribute unselectable must be used instead:

<div unselectable="on">Test Text</div>

这篇关于如何在双击时停止高亮显示div元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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