Prop Element Offsetparent
# HTML DOM offsetParent Property
The `offsetParent` is a read-only property of the HTML DOM `Element` interface. It returns a reference to the nearest ancestor element that has a layout position other than `static` (i.e., its CSS `position` is set to `relative`, `absolute`, `fixed`, or `sticky`), or a few other specific container elements.
This property is highly useful when calculating the absolute coordinates of an element on a webpage, as it serves as the reference point for the (prop-element-offsetleft.html) and (prop-element-offsettop.html) properties.
---
## Syntax
```javascript
let parent = element.offsetParent;
```
### Return Value
* **Element Object**: The closest positioned ancestor element.
* **`null`**: Returned if any of the following conditions are met:
* The element or any of its ancestors has its CSS `display` property set to `"none"`.
* The element's CSS `position` is set to `fixed` (in most modern browsers).
* The element is the `` or `` element.
---
## How offsetParent is Determined
To find the `offsetParent`, the browser searches up the DOM tree for the nearest ancestor that meets any of these criteria:
1. Has a CSS `position` other than `static` (e.g., `relative`, `absolute`, `sticky`).
2. Is a ``, ` `, or `` element.
3. Is the `` element.
---
## Code Examples
### Example 1: Basic Usage
Get the closest positioned ancestor of a `
YouTip