I want to make my div tag with id "drag_me" to be draggable up to the length of 300px from left and 460px from top, only using CSS.
I also want to make it resizable. Again same condition as above i.e. no Javascript or jquery.
Can any one suggest the solution for this...
Thanks in advance to all
To make an object draggable set draggable=true on that element. Just about anything can be drag-enabled: images, files, links, files, or any markup on your page.
Btw, you can make a div "draggable" without JS, but you cannot "drag" it.
This is the best you can do without JavaScript:
[draggable=true] { cursor: move; } .resizable { overflow: scroll; resize: both; max-width: 300px; max-height: 460px; border: 1px solid black; min-width: 50px; min-height: 50px; background-color: skyblue; }
<div draggable="true" class="resizable"></div>
Demo
draggable
attribute on HTML5 Rocksresize
property on MDNIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With