I'm in the process of creating a drag and drop module and I want to ensure that as the user drags an item, the dashed line around the outside moves inward and the box changes color. However, I don't want the appearance of the dashed line to change. One idea is to animate the movement of the dashed line along the edge of the box.
.
- How can I prevent the contents from jumping by applying absolute positioning to disconnect them from the border morphing?
- Is there a way to smoothly animate the border moving in and out using CSS3?
HTML:
<div class="drag-drop">
<div class="drag-drop-border">
<div class="contents">
xx
</div>
</div>
</div>
CSS:
.drag-drop {
.drag-drop-border {
border: 2px dashed pink;
}
&:hover {
padding: 15px;
background: gold;
}
}
https://i.sstatic.net/O8Y4j.png https://i.sstatic.net/nzLgI.png