<!DOCTYPE html>
<html> <head>
<meta charset="UTF-8">
<title></title>
<script src="jquery-2.2.4.min.js"></script>
<script>
$(window).load(function() {
var myDiv = $('div')
//添加CSS样式
myDiv.css({
'width': '200px',
'padding': '20px',
'height': '200px',
'background': 'red',
'border':"4px solid green",
})
//查看盒子相关属性,高度,宽度,
alert("heigt:" + myDiv.height());
alert("Interheigt:" + myDiv.innerHeight());
alert("Outterheigt:" + myDiv.outerHeight()); alert("offsetLeft:" + myDiv.offset().left + "right:"+myDiv.offset().right); });
</script>
</head> <body>
<div></div>
</body> </html>