Element.clientHeight

  • Revision slug: DOM/element.clientHeight
  • Revision title: element.clientHeight
  • Revision id: 120941
  • Created:
  • Creator: Dewang
  • Is current revision? No
  • Comment

Revision Content

{{template.DomRef()}}

Summary

Returns the inner height of an element in pixels, including padding but not the horizontal scrollbar height, border, or margin.

clientHeight can be calculated as CSS height + CSS padding - height of horizontal scrollbar (if present).

Syntax and values

var h = element.clientHeight;

h is an integer representing the clientHeight of element in pixels.

clientHeight is read–only.

Example

padding-top

Gentle, individualistic and very loyal, Birman cats fall between Siamese and Persian in character. If you admire cats that are non aggressive, that enjoy being with humans and tend to be on the quiet side, you may well find that Birman cats are just the felines for you.

Image:BirmanCat.jpgAll Birmans have colorpointed features, dark coloration of the face, ears, legs and tail.

Cat image and text coming from http://www.best-cat-art.com/

padding-bottom

LeftTopRightBottommargin-topmargin-bottomborder-topborder-bottom

Image:clientHeight.png

Specification

Not part of any W3C specification.

Notes

clientHeight is a non-standard property, which was introduced in Internet Explorer object model. It is HTML-specific property.

References

{{ wiki.languages( { "fr": "fr/DOM/element.clientHeight", "pl": "pl/DOM/element.clientHeight", "zh-cn": "cn/DOM/element.clientHeight" } ) }}

Revision Source

<p>
{{template.DomRef()}}
</p>
<h3 name="Summary"> Summary </h3>
<p>Returns the inner height of an element in pixels, including padding but not the horizontal scrollbar height, border, or margin.
</p><p><code>clientHeight</code> can be calculated as CSS <code>height</code> + CSS <code>padding</code> - height of horizontal scrollbar (if present).
</p>
<h3 name="Syntax_and_values"> Syntax and values </h3>
<pre class="eval">var <var>h</var> = <var>element</var>.clientHeight;
</pre>
<p><var>h</var> is an integer representing the <code>clientHeight</code> of <var>element</var> in pixels.
</p><p><code>clientHeight</code> is read–only.
</p>
<h3 name="Example"> Example </h3>
<div id="offsetContainer" style="margin: 26px 0px; background-color: rgb(255, 255, 204); border: 4px dashed black; color: black; position: absolute; left: 260px;"><div id="idDiv" style="margin: 24px 29px; border: 24px black solid; padding: 0px 28px; width: 199px; height: 102px; overflow: auto; background-color: white; font-size: 13px!important; font-family: Arial, sans-serif;"><p id="PaddingTopLabel" style="text-align: center; font-style: italic; font-weight: bold; font-size: 13px!important; font-family: Arial, sans-serif; margin: 0px;">padding-top</p>
<p>Gentle, individualistic and very loyal, Birman cats fall between Siamese and Persian in character. If you admire cats that are non aggressive, that enjoy being with humans and tend to be on the quiet side, you may well find that Birman cats are just the felines for you.</p>
<p><span style="float: right;"><img alt="Image:BirmanCat.jpg" src="File:en/Media_Gallery/BirmanCat.jpg"></span>All Birmans have colorpointed features, dark coloration of the face, ears, legs and tail.</p>
<p>Cat image and text coming from http://www.best-cat-art.com/ </p>
<p id="PaddingBottomLabel" style="text-align: center; font-style: italic; font-weight: bold; font-size: 13px!important; font-family: Arial, sans-serif; margin: 0px;">padding-bottom</p></div><span style="position: absolute; left: -32px; top: 85px; color: blue; font-weight: bold; font-size: 13px!important; font-family: Arial, sans-serif;">Left</span><span style="position: absolute; left: 170px; top: -20px; color: blue; font-weight: bold; font-size: 13px!important; font-family: Arial, sans-serif;">Top</span><span style="position: absolute; left: 370px; top: 85px; color: blue; font-weight: bold; font-size: 13px!important; font-family: Arial, sans-serif;">Right</span><span style="position: absolute; left: 164px; top: 203px; color: blue; font-weight: bold; font-size: 13px!important; font-family: Arial, sans-serif;">Bottom</span><span style="position: absolute; left: 143px; top: 5px; font-style: italic; font-weight: bold; font-size: 13px!important; font-family: Arial, sans-serif;">margin-top</span><span style="position: absolute; left: 138px; top: 175px; font-style: italic; font-weight: bold; font-size: 13px!important; font-family: Arial, sans-serif;">margin-bottom</span><span style="position: absolute; left: 143px; top: 27px; color: white; font-style: italic; font-weight: bold; font-size: 13px!important; font-family: Arial, sans-serif;">border-top</span><span style="position: absolute; left: 138px; top: 153px; color: white; font-style: italic; font-weight: bold; font-size: 13px!important; font-family: Arial, sans-serif;">border-bottom</span></div>
<p style="margin-top: 270px;"><img alt="Image:clientHeight.png" src="File:en/Media_Gallery/ClientHeight.png"></p>
<h3 name="Specification">Specification</h3>
<p>Not part of any W3C specification.
</p>
<h3 name="Notes">Notes</h3>
<p><code>clientHeight</code> is a non-standard property, which was introduced in Internet Explorer object model. It is HTML-specific property.
</p>
<h3 name="References">References</h3>
<ul><li> <a class="external" href="http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/clientheight.asp?frame=true">MSDN clientHeight definition</a>
</li><li> <a class="external" href="http://msdn.microsoft.com/workshop/author/om/measuring.asp">MSDN Measuring Element Dimension and Location</a>
</li><li> <a class="external" href="http://www.mozilla.org/docs/dom/domref/clientHeight.html">Gecko DOM Reference on clientHeight</a>
</li></ul>
{{ wiki.languages( { "fr": "fr/DOM/element.clientHeight", "pl": "pl/DOM/element.clientHeight", "zh-cn": "cn/DOM/element.clientHeight" } ) }}
Revert to this revision