Html 什么是 -webkit-user-drag css 属性?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15034842/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the -webkit-user-drag css property?
提问by Christopher Scott
I've seen this a couple places now, but can't find much information about it:
我现在已经在几个地方看到了这个,但找不到关于它的太多信息:
-webkit-user-drag: element
Is this part of the standard for HTML5 Drag and Drop? Is this better/worse than using the attribute version:
这是 HTML5 拖放标准的一部分吗?这是否比使用属性版本更好/更糟:
<div draggable="true">my draggable element</div>
Edit: I'm familiar with the current spec and using the draggable attribute, what I'm unclear on is exactly the CSS property *-user-drag.
编辑:我熟悉当前的规范并使用 draggable 属性,我不清楚的是 CSS 属性 *-user-drag。
回答by Blender
It's a Webkit-specific property. Here's what the WebKit documentationsays about it:
它是 Webkit 特定的属性。以下是WebKit 文档对此的说明:
Making an Element Draggable
WebKit provides automatic support to let users drag common items, such as images, links, and selected text. You can extend this support to include specific elements on an HTML page. For example, you could mark a particular div or span tag as draggable.
To mark an arbitrary element as draggable, add the
-webkit-user-drag
attribute to the style definition of the element. Because-webkit-user-drag
is a cascading style sheet (CSS) attribute, you can include it as part of a style definition, or as an inline style attribute on the element tag. The values for this attribute are listed in Table 4-1.Values for
-webkit-user-drag
attribute:
none
: Do not allow this element to be dragged.
element
: Allow this element to be dragged.
auto
: Use the default logic for determining whether the element should be dragged. (Images, links, and text selections are the only elements that can be dragged.) This is the default value.
使元素可拖动
WebKit 提供自动支持让用户拖动常见项目,例如图像、链接和选定的文本。您可以扩展此支持以在 HTML 页面上包含特定元素。例如,您可以将特定的 div 或 span 标签标记为可拖动。
要将任意元素标记为可拖动,请将
-webkit-user-drag
属性添加到元素的样式定义中。因为-webkit-user-drag
是级联样式表 (CSS) 属性,您可以将其作为样式定义的一部分或作为元素标记上的内联样式属性包含在内。此属性的值在表 4-1 中列出。
-webkit-user-drag
属性值:
none
: 不允许拖动该元素。
element
: 允许拖动该元素。
auto
: 使用默认逻辑来确定是否应该拖动元素。(图像、链接和文本选择是唯一可以拖动的元素。)这是默认值。
It's supported by all browsers using the WebKit rendering engine, so Chrome, newer versions of Opera, Safari, etc. Support in mobile browsers using WebKit may vary depending on the mobile OS.
使用 WebKit 渲染引擎的所有浏览器都支持它,因此 Chrome、较新版本的 Opera、Safari 等。使用 WebKit 的移动浏览器中的支持可能因移动操作系统而异。
回答by tim.baker
Brief overview: http://www.html5rocks.com/en/tutorials/dnd/basics/
简要概述:http: //www.html5rocks.com/en/tutorials/dnd/basics/
Detailed info: http://www.quirksmode.org/blog/archives/2009/09/the_html5_drag.html
详细信息:http: //www.quirksmode.org/blog/archives/2009/09/the_html5_drag.html