首页 > 其他 > 详细

6.2.24 BOM-Client系列

时间:2018-07-22 10:07:04      阅读:181      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			.box{
				width: 200px;
				height: 200px;
				position: absolute;
				border: 20px solid red;
				margin: 10px 0px 0px 0px;
				padding: 10px;
			}
		</style>
	</head>
	<body>
		<div class="box">
			
		</div>
	</body>
	<script type="text/javascript">
		/*style
			 * top
			 * left
			 * right
			 * bottom
		 
		 * client
		 *   clientTop 内容区域到边框顶部的距离
		 * 	 clientLeft 内容区域到边框左部的距离
		 *   clientWidth 内容区域+左右padding   可视宽度
		 * 	 clientHeight 内容区域+ 上下padding   可视高度
		 * */
		
		var oBox = document.getElementsByClassName(‘box‘)[0];
		
		console.log(oBox.clientTop)
		console.log(oBox.clientLeft)
		console.log(oBox.clientWidth)
		console.log(oBox.clientHeight)
		
		
	</script>
	
</html>

  

6.2.24 BOM-Client系列

原文:https://www.cnblogs.com/beallaliu/p/9349051.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!