JS's offsetparent attribute usage is detailed:
This property is more commonly used in JavaScript properties, for its good grasp is also very necessary, the following through the code example to introduce its use, hoping to bring some help to the needs of friends.
I. Basic introduction:
This property can return a reference to a body object that has the closest adoption positioning (the Position property value is a fixed, relative, or absolute) parent element, if the parent element does not take a positioned element.
syntax structure:
Obj.offsetparent
Two. code example:
<! doctype html>
<! doctype html> in the preceding code, because the inner element does not have a positioned element in its parent element, the Offsetparent property returns a reference to the body object, so the ID property value of the Body object is written to the inner element.
Special Note:
1. In the IE7 browser, offsetparent will return a reference to the first-level parent element object.
2. If the display property value of the positioned parent element is none, this property returns a value of NULL.
The original address is: JS's offsetparent attribute usage detailed
The offsetparent attribute usage of JS is detailed