HTML | DOM MouseEvent offsetX Property Last Updated : 13 Jun, 2022 Comments Improve Suggest changes Like Article Like Report The MouseEvent offsetX property is a read-only property which is used for returning the x-coordinate of the mouse pointer, relative to the target element. Syntax : event.offsetX Return Value: It returns a number which represents the horizontal coordinate of the mouse pointer, in pixels. Below program illustrates the MouseEvent offsetX property: Example: Finding out the horizontal coordinate of the mouse pointer relative to a <div> element. html <!DOCTYPE html> <html> <head> <title>MouseEvent offsetX Property in HTML</title> <style> div { border: 3px solid green; height: 100px; width: 500px; } h1 { color: green; } h2 { font-family: Impact; } body { text-align: center; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>MouseEvent offsetX Property</h2> <p>Click inside the green box to get the x-coordinate relative to the top edge.</p> <div onclick="coord(event)"></div> <p>The x-coordinate, relative to the top edge of the DIV element is: <span id="test"></span></p> <script> function coord(event) { var c = event.offsetX; document.getElementById( "test").innerHTML = c; } </script> </body> </html> Output: After clicking the button: After clicking the button: Supported Browsers: Opera 12.1 and aboveInternet Explorer 9 and aboveGoogle Chrome 1 and aboveEdge 12 and aboveFirefox 39 and aboveApple Safari 1 and above Comment More infoAdvertise with us S Shubrodeep Banerjee Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML | DOM Input Submit Object The Input Submit object in HTML DOM represents the HTML <input> element with type = "submit" attribute. Syntax: It creates an Input Submit Object.document.createElement("INPUT")It is used to access an Input Submit Object.document.getElementById("id") Property Values: autofocus: It sets or retu 3 min read HTML | DOM Input URL Object The Input URL object in HTML DOM represents an <input> element with type = "url" attribute. The element with type url can be accessed by using getElementById() method. Syntax: document.getElementById("id"); where id is assigned to the <input> tag. Property Values: list: It returns the re 3 min read HTML DOM Window frames Properties The HTML DOM Window frames property in HTML DOM is used to return the frame element in the form of an array object. This property represents all <iframe> elements in the current window. DOM Windowframe is a read-only property. Syntax:window.framesProperties:length property: It returns the numb 2 min read HTML | DOM Window opener Properties The Window opener property in HTML DOM is used to return the reference of newly created windows. This property is used to return the details of the source (parent) window. A window is opened using the window.open() method and closed using the window.opener.close() method. Syntax:window.openerReturn 2 min read HTML | DOM Style transitionTimingFunction property The DOM Style transitionTimingFunction property allows a transition effect to change speed over its duration. Transition effect provides a way to control animation speed when changing properties. Syntax: To set the property:object.style.transitionTimingFunction = "ease|linear|ease-in| ease-out|ease- 2 min read HTML DOM Style textAlign Property The HTML DOM style textAlign property is similar to the text-align property in the CSS. It sets the alignment for the inner content of a block element using HTML DOM. SyntaxWe can use textAlign in two different ways, one to set the alignment, and the other to get the current alignment. Get the valu 3 min read HTML | DOM Style visibility Property The Style visibility property in HTML DOM used to set the visibility for an element. It is used to hide or show the element. It returns the visibility property that is given to an element. Syntax: It returns the visibility property.object.style.visibilityIt is used to set the visibility property. ob 2 min read HTML DOM Style transitionProperty Property The Style transitionProperty property in HTML DOM used to set the name of the CSS property for the transition effect. It can occur when a user hover over an element. It returns the transitionProperty property of an element. Syntax: It returns the transitionProperty property. object.style.transitionP 2 min read HTML | DOM Style position Property The position property sets or returns the type of positioning method used by the element. It may be static, relative, absolute or fixed. Syntax: Return position syntax: object.style.position Set position syntax: object.style.position = "static | absolute | fixed | relative | sticky | initial | inher 4 min read HTML | DOM Style textDecorationLine Property The Style textDecorationLine property in HTML DOM used to set the decoration for a line. We can specify any number of decorations for a line. It returns the decoration that is given to the text. Syntax: It returns the textDecorationLine property. object.style.textDecorationLineIt is used to set the 2 min read Like