菜鸟教程offsetLeft 是一个只读属性,返回当前元素相对于 offsetParent 节点左边界的偏移像素值。 返回值包含: 注意: offsetParent 元素是一个指向最近的(指包含层级上的最近)包含该元素的定位元 HTML DOM offsetParent 属性HTML DOM offsetWidth 属性HTML DOM offsetTop 属性更多内容请查看https://www.runoob.com/jsref/prop-element-offsetleft.html
Mozilla Developerhttps://developer.mozilla.org//API/HTMLElement/offsetLeftHTMLElement.offsetLeft HTMLElement.offsetLeft 是一个只读属性,返回当前元素左上角相对于 HTMLElement.offsetParent 节点的左边界偏移的像素值。 对块级元素来说,offsetTop HTMLElement.offsetHeightHTMLElement.offsetWidthHTMLElement.offsetTopWeb API 接口参考更多内容请查看https://developer.mozilla.org/zh-CN/docs/Web/API/HTMLElement/offsetLeft