aboutsummaryrefslogtreecommitdiff
path: root/files/zh-tw/web/api/element/clientheight/index.html
blob: 99ae4faf06dde90620ce70e502638bd00c2d6636 (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
53
54
55
56
57
58
59
60
61
62
---
title: Element.clientHeight
slug: Web/API/Element/clientHeight
tags:
  - API
  - Reference
translation_of: Web/API/Element/clientHeight
---
<p>{{ APIRef("DOM") }}</p>

<p><code><strong>Element.clientHeight </strong></code>唯讀屬性會回傳元素內部高度(像素),包含 padding 但並未包含水平滾動條、border、margin。</p>

<p><code>clientHeight</code> 可以被計算成 CSS <code>height</code> + CSS <code>padding</code> - 水平滾動條的高度(如果有顯示)</p>

<div class="note">
<p><strong>Note:</strong> 這個屬性會以四捨五入進位取整數. 如果要使用非整數值, 使用 {{ domxref("element.getBoundingClientRect()") }}.</p>
</div>

<h2 id="Syntax_and_values" name="Syntax_and_values">表達式</h2>

<pre class="syntaxbox">var <var>h</var> = <var>element</var>.clientHeight;</pre>

<p><code><var>h</var></code> 代表元素高度(pixels)的正整數.</p>

<h2 id="Example" name="Example">範例</h2>

<p> </p>

<p>              <img alt="Image:Dimensions-client.png" class="internal" src="/@api/deki/files/185/=Dimensions-client.png"></p>


<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-element-clientheight', 'clientHeight')}}</td>
   <td>{{Spec2('CSSOM View')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h3 id="Notes" name="Notes"></h3>

<p><code>clientHeight</code> 是在 the Internet Explorer 物件介紹的屬性.</p>

<h2 id="See_Also" name="See_Also">參見</h2>

<ul>
 <li>{{domxref("HTMLElement.offsetHeight")}}</li>
 <li>{{domxref("Element.scrollHeight")}}</li>
 <li><a href="/en-US/docs/Determining_the_dimensions_of_elements">Determining the dimensions of elements</a></li>
 <li><a href="https://docs.microsoft.com/en-us/previous-versions//hh781509(v=vs.85)">MSDN Measuring Element Dimension and Location</a></li>
</ul>