<input type="button" onclick="addRow()" value="Add Item"/>
和user-select
属性之间的主要区别是什么?所有浏览器都支持它们吗?
答案 0 :(得分:0)
主要区别在于,user-select
允许您选择然后复制某些内容(如果需要),而user-drag
则允许您拖动某些内容,例如HTML元素。
我知道user-select
可以在不同的浏览器中使用,但是您应该设置CSS规则,如下所示:
-webkit-user-select: all;
-moz-user-select: all;
-ms-user-select: all;
user-select: all;
答案 1 :(得分:0)
默认情况下,如User Select - MDN web Docs中所述,用户选择特定于.fixed-div{
position: fixed;
left: 50vw;
top: 30vh;
transform: translate(-50%, -50%); /* Moves the center of the element to its original top left corner*/
z-index: 1;
}
,对文本启用用户选择。要禁用该属性,请使用下面提到的CSS样式。
text
User Drag是通用的,可以应用于-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
div, image, p, etc.,
下面是用于用户拖动的CSS
<p draggable="true">Contents</p> //Enable dragging
<img src="image.jpg" draggable="false" alt="can't be dragged"></img> //Disable dragging