Advertisement

offsetLeft和offsetTop的详细分析

阅读量:

offsetLeft、offsetTop全面解析

一、首个实例说明

复制代码
    <body>
    <style>
    body { margin:0;  }
    .box1 { width:300px; height:300px; margin:100px; background:#333; overflow:hidden; }
    .box2 { width:200px; height:200px; margin:100px; background:#666; overflow:hidden; }
    .box3 { width:100px; height:100px; margin:100px; background:#999;}
    </style>
    <div class="box1">
    <div class="box2">
    	<div class="box3"></div>
    </div>
    </div>
    <script>
    var oBox1 = document.querySelector('.box1');
    var oBox2 = document.querySelector('.box2');
    var oBox3 = document.querySe

全部评论 (0)

还没有任何评论哟~