offsetHeight offsetWidth clientHeight clientWidth scrollHeight scrollWidth offsetLeft offsetRight scrollTop scrollLeft clientLeft: 左边界
获取margin 值
var p = document.getElementById('parent-node')
undefined
window.getComputedStyle(p)
window.getComputedStyle(p).marginTop
<<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
<style>
#parent-node {
margin-top: 300px;
margin-left: 300px;
height: 400px;
width: 400px;
background: grey;
padding:20px;
position: relative;
}
#child-node {
background: blue;
width: 200px;
height: 200px;
overflow: auto;
border-left: 1px solid red;
}
p {
width: 300px;
}
</style>
</head>
<body>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div id="parent-node">
<div id="child-node">
<p> ddd dddddddddd ddddddddd ddddddddd</p>
<p> ddd </p>
<p> ddd </p>
<p> ddd </p>
<p> ddd </p>
<p> ddd </p>
<p> ddd </p>
<p> ddd </p>
<p> ddd </p>
<p> ddd </p>
<p> ddd </p>
<p> ddd </p>
<p> ddd </p>
</div>
</div>
</body>
</html>