菜鸟教程定义和用法. offsetTop 是一个只读属性,返回当前元素相对于 offsetParent 节点顶部边界的偏移像素值。 返回值包含: 元素顶部偏移的像素值,元素的外边距(margin) offsetParent 元素的顶 offsetParent注意: offsetParent 用于 offsetLeft 和 offsetTop 属性。 提示: 当元素的 HTML DOM offsetLeft 属性offsetLeft 是一个只读属性,返回当前元素相对于 offsetParent 节点左边界的偏移像 HTML DOM offsetWidth 如果元素被隐藏(例如:元素或者元素的祖先之一的元素的 style.display 被设置为 HTML DOM Document 对象HTML DOM Document 对象 HTML DOM 节点 在 HTML DOM (Document Object 仅显示来自 runoob.com 的更多内容请查看https://www.runoob.com/jsref/prop-element-offsettop.html
SegmentFault 思否javascript The HTMLElement.offsetParent read-only property returns a reference to the element which is the closest (nearest in the containment hierarchy) positioned ancestor element. If there is no positioned ancestor 更多内容请查看https://segmentfault.com/q/1010000023864364
SegmentFault 思否Js中 关于top、clientTop、scrollTop、offsetTop2016年11月3日 · 一、offsetTop 返回的是数字,而 style.top 返回的是字符串,除了数字外还带有单位:px。 二、offsetTop 只读,而 style.top 可读写。 三、如果没有给 HTML 元素指定过 top 更多内容请查看https://segmentfault.com/a/1190000007369831