Atributo HTML arrastável
Exemplo
Um parágrafo arrastável:
<p draggable="true">This is a draggable paragraph.</p>
Definição e uso
O draggable
atributo especifica se um elemento pode ser arrastado ou não.
Dica: Links e imagens podem ser arrastados por padrão.
Dica: O draggable
atributo é frequentemente usado em operações de arrastar e soltar. Leia nosso tutorial de arrastar e soltar HTML para saber mais.
Suporte ao navegador
Os números na tabela especificam a primeira versão do navegador que suporta totalmente o atributo.
Attribute | |||||
---|---|---|---|---|---|
draggable | 4.0 | 9.0 | 3.5 | 6.0 | 12.0 |
Sintaxe
<element draggable="true|false|auto">
Valores de atributo
Value | Description |
---|---|
true | Specifies that the element is draggable |
false | Specifies that the element is not draggable |
auto | Uses the default behavior of the browser |
Páginas relacionadas
Tutorial HTML: Atributos HTML
Tutorial HTML: Arrastar e Soltar HTML5
Referência JavaScript: o evento ondrag