In HTML5, which statement about drag and drop is true?

Learn web design with our comprehensive test guide. Improve your skills with flashcards and multiple choice questions. Each question includes hints and explanations. Get ready to ace your exam!

Multiple Choice

In HTML5, which statement about drag and drop is true?

Explanation:
HTML5 drag and drop works by marking elements with a draggable attribute. This global attribute lets you turn almost any element into a draggable item by setting draggable="true" on it. That flexibility is why the statement that any element can be draggable is the best choice: you’re not limited to images—you can apply dragging to divs, spans, headings, or any other element you choose, and you control what happens when it’s dragged and dropped. In practice, you’d typically listen for dragstart to set the data you’re carrying, and use dragover and drop on targets to allow dropping and to handle the result. You’ll sometimes see images dragged by default in browsers, but that doesn’t limit the API to images—draggable can be added to other elements as well. Drag and drop is a standardized HTML5 feature, and while JavaScript is commonly used to implement the specific behavior (data transfer, drop targets, etc.), the ability to drag elements is provided by the HTML5 API itself.

HTML5 drag and drop works by marking elements with a draggable attribute. This global attribute lets you turn almost any element into a draggable item by setting draggable="true" on it. That flexibility is why the statement that any element can be draggable is the best choice: you’re not limited to images—you can apply dragging to divs, spans, headings, or any other element you choose, and you control what happens when it’s dragged and dropped.

In practice, you’d typically listen for dragstart to set the data you’re carrying, and use dragover and drop on targets to allow dropping and to handle the result. You’ll sometimes see images dragged by default in browsers, but that doesn’t limit the API to images—draggable can be added to other elements as well. Drag and drop is a standardized HTML5 feature, and while JavaScript is commonly used to implement the specific behavior (data transfer, drop targets, etc.), the ability to drag elements is provided by the HTML5 API itself.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy