aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/api/htmlelement/offsetparent/index.html
blob: d3434b8ec27fc4358471eefc20dbdd49d17868e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
title: HTMLElement.offsetParent
slug: Web/API/HTMLElement/offsetParent
tags:
  - API
  - CSSOM View
  - Propiedad
  - Reference
  - Referencia
translation_of: Web/API/HTMLElement/offsetParent
---
<div>
<div>{{ APIRef("HTML DOM") }}</div>
</div>

<p>La propiedad de solo lectura <strong><code>HTMLElement.offsetParent</code></strong> 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, <code>td</code><code>th</code><code>table</code> o el <code>body</code> más cercano es retornado.</p>

<p><code>offsetParent</code> retorna <code>null</code> cuando el elemento <code>style.display</code> tiene asignado <code>none</code>. <code>offsetParent</code> es útil porque {{domxref("HTMLElement.offsetTop","offsetTop")}} y {{domxref("HTMLElement.offsetLeft","offsetLeft")}} son relativos a su borde de relleno.</p>

<h2 id="Syntax" name="Syntax">Sintaxis</h2>

<pre class="syntaxbox"><var>parentObj</var> = element.offsetParent;
</pre>

<ul>
 <li><var>parentObj</var> es una referencia de objeto al elemento en el cual el elemento actual es offset.</li>
</ul>

<h2 id="Specification" name="Specification">Especificación</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Especificación</th>
   <th scope="col">Estatus</th>
   <th scope="col">Comentario</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('CSSOM View', '#dom-htmlelement-offsetparent', 'offsetParent')}}</td>
   <td>{{Spec2('CSSOM View')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="Compatibility" name="Compatibility">Compatibilidad de Browser</h2>



<p>{{Compat("api.HTMLElement.offsetParent")}}</p>