SOURCE

console 命令行工具 X clear

                    
>
console
var text = document.querySelector('#text');
text.style.fontSize = 20 + 'px';


var box = document.querySelector('#box');
box.onmousedown = function (e) {
    var juli = e.clientX - box.offsetLeft;
    var margin = e.clientY - box.offsetTop;
    document.onmousemove = function (e) {
        box.style.left = (e.clientX - juli) + 'px';
        box.style.top = (e.clientY - margin) + 'px';
    }
}

box.onmouseup = function () {
    document.onmousemove = null;
}
<html>
    <body>
        <div id="box" class="box">

        </div>
        <p id="text">nihao</p>
    </body>
</html>
#text{
    color: pink;
}
.box{
    position: absolute;
    margin: 0 auto;
    width: 100px;
    height: 100px;
    background: #ddd;
}