blob: f79d785530fd04e9969c8ced45186c8c4c8e3488 (
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
|
---
title: HTMLElement.offsetParent
slug: Web/API/HTMLElement/offsetParent
translation_of: Web/API/HTMLElement/offsetParent
---
<div>
<div>{{ APIRef("HTML DOM") }}</div>
</div>
<p><strong><code>HTMLElement.offsetParent</code></strong> 읽기전용 프라퍼티는 가장 가까운 (포함 계층에서 가장 가까운) 위치가 정해진 포함하는 엘리먼트 객체에 대한 참조를 반환한다. <code>offsetParent</code>는 엘리먼트의 위치가 정해지지 않으면 가장 가까운 테이블 또는 테이블 셀, 루트 엘리먼트 (표준 준수 모드에서는 <code>html</code>; quirks 렌더링 모드에서는 <code>body</code>) 를 반환한다.<br>
엘리먼트의 <code>style.display</code>가 "none"으로 설정되면 null을 반환한다. <code>offsetParent</code>는 {{domxref("HTMLElement.offsetTop","offsetTop")}}과 {{domxref("HTMLElement.offsetLeft","offsetLeft")}}가 그것의 패딩 모서리에 상대적이기 때문에 유용하다.</p>
<h2 id="Syntax" name="Syntax">문법</h2>
<pre class="syntaxbox"><var>parentObj</var> = element.offsetParent;
</pre>
<ul>
<li><var>parentObj는 현재 엘리먼트가 그 안에서 offset된 엘리먼트의 객체 참조이다. </var> is an object reference to the element in which the current element is offset.</li>
</ul>
<h2 id="Specification" name="Specification">명세</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">명세</th>
<th scope="col">상태</th>
<th scope="col">주석</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">브라우저 호환성</h2>
<p>{{Compat("api.HTMLElement.offsetParent")}}</p>
|