HTML | DOM clientLeft Property

The DOM clientLeft Property is used to return the width of the left border to an element in terms of pixel.It does not include the measurement of the width of the left padding or the left margin.It is read-only property.

Syntax:

element.clientLeft 

Return Value: It returns a numeric value which represent the width of the left border to an element.



Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>
        HTML | DOM clientLeft Property
  
    </title>
    <style>
        h1 {
            color: green;
            font-size: 35px;
        }
          
        #GFG {
            height: 100px;
            width: 350px;
            padding: 20px;
            margin: 25px;
            border: 10px solid coral;
            background-color: green;
        }
    </style>
</head>
  
<body>
    <center>
        <h1>GeeksForGeeks</h1>
        <h2>DOM clientLeft Property </h2>
  
        <div id="GFG">
            <p style="color:white;font-size:25px;">
                GeeksforGeeks
            </p>
            <p id="sudo" style="color:white;"></p>
        </div>
        <button onclick="Geeks()">Submit</button>
        <script>
            function Geeks() {
                var w = document.getElementById("GFG");
  
                // Using clientTop property
                var x = "Border-Top-Width is: " 
                + w.clientTop + "px<br>";
  
                x += "Border-Left-width  : " 
                + w.clientLeft + "px";
                document.getElementById("sudo").innerHTML = x;
            }
        </script>
    </center>
  
</body>
  
</html>

chevron_right


Output:

  • Initially:

  • After Click on the Button:

Supported Browsers: The browser supported by DOM clientLeft property are listed below:

  • Google Chrome 1.0
  • Internet Explorer 4.0
  • Firefox 1.0
  • Opera 3.5
  • Safari 1.0


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.