Element.clientLeft

  • Revision slug: DOM/element.clientLeft
  • Revision title: element.clientLeft
  • Revision id: 164669
  • Created:
  • Creator: George3
  • Is current revision? No
  • Comment /* References */ Convert links to {{MSDN|...}}

Revision Content

{{ Fx_minversion_header("3") }} {{ DomRef() }}

Summary

The width of the left border of an element in pixels. It includes the width of the vertical scrollbar if the text direction of the element is right–to–left and if there is an overflow causing a left vertical scrollbar to be rendered. clientLeft does not include the left margin or the left padding. clientLeft is read-only.

Gecko-based applications support clientLeft starting with Gecko 1.9 (Firefox 3, implemented in {{ Bug("111207") }}). This property is not supported in Firefox 2 and earlier.

Syntax

var left = element.clientLeft;

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 www.best-cat-art.com

padding-bottom

LeftTopRightBottommargin-topmargin-bottomborder-topborder-bottom{{ mediawiki.external('if IE') }}><span id="MrgLeft" style="position: absolute; left: 8px; top: 65px; font: bold 13px Arial, sans-serif !important; writing-mode: tb-rl;">margin-left</span><span id="BrdLeft" style="position: absolute; left: 33px; top: 65px; color: white; font: bold 13px Arial, sans-serif !important; writing-mode: tb-rl;">border-left</span><span id="PdgLeft" style="position: absolute; left: 55px; top: 65px; font: bold 13px Arial, sans-serif !important; writing-mode: tb-rl;">padding-left</span><span id="PdgRight" style="position: absolute; left: 275px; top: 60px; color: black; font: bold 13px Arial, sans-serif !important; writing-mode: tb-rl; white-space: nowrap;">padding-right</span><span id="BrdRight" style="position: absolute; left: 310px; top: 65px; color: white; font: bold 13px Arial, sans-serif !important; writing-mode: tb-rl;">border-right</span><span id="MrgRight" style="position: absolute; left: 340px; top: 65px; font: bold 13px Arial, sans-serif !important; writing-mode: tb-rl;">margin-right</span><!{{ mediawiki.external('endif') }}

Image:clientLeft.png

Vertical scrollbar position when layout.scrollbar.side property is set to 1 or to 3

When layout.scrollbar.side property is set to 1 or to 3 and when the text-direction is set to RTL, then the vertical scrollbar is positioned on the left and this impacts the way clientLeft is computed.

Specification

Not part of any W3C specification.

Notes

clientLeft was first introduced in the MS IE DHTML object model.

The position of the vertical scrollbar in right–to–left text direction set on the element will depend on the layout.scrollbar.side preference

References

  • {{ MSDN("ms533564", "clientLeft Property") }}
  • {{ MSDN("ms530302", "Measuring Element Dimension and Location") }}



{{ languages( { "es": "es/DOM/element.clientLeft", "fr": "fr/DOM/element.clientLeft", "ja": "ja/DOM/element.clientLeft", "pl": "pl/DOM/element.clientLeft" } ) }}

Revision Source

<p>{{ Fx_minversion_header("3") }} {{ DomRef() }}
</p>
<h3 id="Summary" name="Summary">Summary</h3>
<p>The width of the left border of an element in pixels. It includes the width of the vertical scrollbar if the text direction of the element is right–to–left and if there is an overflow causing a left vertical scrollbar to be rendered. <code>clientLeft</code> does not include the left margin or the left padding. <code>clientLeft</code> is read-only.
</p><p><a href="en/Gecko">Gecko</a>-based applications support <code>clientLeft</code> starting with Gecko 1.9 (<a href="en/Firefox_3">Firefox 3</a>, implemented in {{ Bug("111207") }}). This property is not supported in Firefox 2 and earlier.
</p>
<h3 id="Syntax" name="Syntax">Syntax</h3>
<pre class="eval">var <var>left</var> = <var>element</var>.clientLeft;
</pre>
<h3 id="Example" 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" fileid="44" 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 <a class="external" href="http://www.best-cat-art.com/">www.best-cat-art.com</a></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: -24px; 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><span class="comment">{{ mediawiki.external('if IE') }}&gt;&lt;span id="MrgLeft" style="position: absolute; left: 8px; top: 65px; font: bold 13px Arial, sans-serif !important; writing-mode: tb-rl;"&gt;margin-left&lt;/span&gt;&lt;span id="BrdLeft" style="position: absolute; left: 33px; top: 65px; color: white; font: bold 13px Arial, sans-serif !important; writing-mode: tb-rl;"&gt;border-left&lt;/span&gt;&lt;span id="PdgLeft" style="position: absolute; left: 55px; top: 65px; font: bold 13px Arial, sans-serif !important; writing-mode: tb-rl;"&gt;padding-left&lt;/span&gt;&lt;span id="PdgRight" style="position: absolute; left: 275px; top: 60px; color: black; font: bold 13px Arial, sans-serif !important; writing-mode: tb-rl; white-space: nowrap;"&gt;padding-right&lt;/span&gt;&lt;span id="BrdRight" style="position: absolute; left: 310px; top: 65px; color: white; font: bold 13px Arial, sans-serif !important; writing-mode: tb-rl;"&gt;border-right&lt;/span&gt;&lt;span id="MrgRight" style="position: absolute; left: 340px; top: 65px; font: bold 13px Arial, sans-serif !important; writing-mode: tb-rl;"&gt;margin-right&lt;/span&gt;&lt;!{{ mediawiki.external('endif') }}</span></div>
<p style="margin-top: 270px;"><img alt="Image:clientLeft.png" fileid="610" src="File:en/Media_Gallery/ClientLeft.png"></p>
<p><img alt="Vertical scrollbar position when layout.scrollbar.side property is set to 1 or to 3" fileid="611" src="File:en/Media_Gallery/ClientLeftRtl.png"></p>
<p>When <a class="external" href="http://kb.mozillazine.org/Layout.scrollbar.side"><i>layout.scrollbar.side</i> property</a> is set to 1 or to 3 and when the text-direction is set to RTL, <b>then the vertical scrollbar is positioned on the left</b> and this impacts the way clientLeft is computed.</p>
<h3 id="Specification" name="Specification">Specification</h3>
<p>Not part of any W3C specification.
</p>
<h3 id="Notes" name="Notes">Notes</h3>
<p><code>clientLeft</code> was first introduced in the MS IE DHTML object model.
</p><p>The position of the vertical scrollbar in right–to–left text direction set on the element will depend on the <a class="external" href="http://kb.mozillazine.org/Layout.scrollbar.side"><i>layout.scrollbar.side</i> preference</a>
</p>
<h3 id="References" name="References">References</h3>
<ul><li> {{ MSDN("ms533564", "clientLeft Property") }}
</li><li> {{ MSDN("ms530302", "Measuring Element Dimension and Location") }}
</li></ul>
<p><br>
</p><p><br>
</p>
<div class="noinclude">
</div>
{{ languages( { "es": "es/DOM/element.clientLeft", "fr": "fr/DOM/element.clientLeft", "ja": "ja/DOM/element.clientLeft", "pl": "pl/DOM/element.clientLeft" } ) }}
Revert to this revision