Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML | DOM offsetLeft Property

  • Difficulty Level : Easy
  • Last Updated : 26 Jul, 2019

The DOM offsetLeft property is used to returns the left position in pixels. This position is relative to the left side of the offsetParent element.



Return Value: It returns the number representing the left position of the element in pixels.


<!DOCTYPE html> 
            DOM offsetLeft Property
            #GFG {
                height: 50px;
                width: 200px;
                padding: 10px;
                background-color: green;
            DOM Style offsetLeft Property
        <div id = "GFG">
            <b>Information about this div:</b><br>
            <p id = "demo"></p>
        <button type = "button" onclick = "geeks()"
            function geeks() { 
                var testDiv = document.getElementById("GFG");
                    = "offsetLeft: "+ testDiv.offsetLeft;

Before Click on the button:

After Click on the button:

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

  • Google Chrome
  • Internet Explorer 8.0
  • Firefox
  • Opera
  • Safari

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!