The offsetparent attribute usage of JS is detailed

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.