--- title: HTMLElement.offsetParent slug: Web/API/HTMLElement/offsetParent tags: - API - CSSOM View - Propiedad - Reference - Referencia translation_of: Web/API/HTMLElement/offsetParent ---
La propiedad de solo lectura HTMLElement.offsetParent retorna una referencia al objeto, el cual es el elemento contenedor posicionado más cercano (más cercano en la jerarquía contenedora). Si el elemento es no-posicionado, td, th, table o el body más cercano es retornado.
offsetParent retorna null cuando el elemento style.display tiene asignado none. offsetParent es útil porque {{domxref("HTMLElement.offsetTop","offsetTop")}} y {{domxref("HTMLElement.offsetLeft","offsetLeft")}} son relativos a su borde de relleno.
parentObj = element.offsetParent;
| Especificación | Estatus | Comentario |
|---|---|---|
| {{SpecName('CSSOM View', '#dom-htmlelement-offsetparent', 'offsetParent')}} | {{Spec2('CSSOM View')}} |
{{Compat("api.HTMLElement.offsetParent")}}