HTML | DOM Style right Property Last Updated : 05 Jun, 2022 Comments Improve Suggest changes Like Article Like Report The Style right property in HTML DOM is used to set or return the right position of a positioned element including padding, scrollbar, border, and margin. Syntax: It is used to return the right property:object.style.rightIt is used to set the right property:object.style.right = "auto|length|%|initial|inherit" Return Values: It returns a string that represents the right position of a positioned element Property Value Description: auto- This value automatically sets the default right value by the browser.length- This value sets the right value in the specified length units. This specified length can be positive as well as negative.%- Percentage value sets the right value in the specified percentage of the parent element’s width.initial- This value sets the right property to its browser’s default value.inherit- This value sets the right property to the value from its parent element. Example 1: html <!DOCTYPE html> <html> <head> <title> HTML | DOM Style right Property </title> <style> #GfG { position: absolute; background-color: green; color: white; } </style> </head> <body> <h1> Geeks for Geeks </h1> <h2> HTML|DOM Style right Property </h2> <button onclick="myFunction()">Click here</button> <GfG id="GfG"> <h1>GfG</h1> </GfG> <script> function myFunction() { document.getElementById("GfG") .style.right = "100px"; } </script> </body> </html> Output: Before click on the button: After click on the button: Example 2: html <!DOCTYPE html> <html> <head> <title> HTML | DOM Style right Property </title> <style> #myGfG { border: 1px solid #FF0000; position: relative; } </style> </head> <body> <h1> Geeks for Geeks </h1> <h2> HTML|DOM Style right Property </h2> <GfG id="myGfG">Welcome to Geeks for Geeks.</GfG> <br> <button type="button" onclick="myFunction()"> Click Here! </button> <script> function myFunction() { document.getElementById("myGfG") .style.right = "-200px"; } < GfG id = "myGfG" > Welcome to Geeks for Geeks. < /GfG> < br > < button type = "button" onclick = "myFunction()" > Click Here! < /button> < script > function myFunction() { document.getElementById("myGfG") .style.right = "-200px"; } </script> </body> </html> </script> </body> </html> Output:Before click on the button: After click on the button: Supported Browsers: Google Chrome 1 and aboveEdge 12 and aboveInternet Explorer 5.5 and aboveFirefox 1 and aboveOpera 5 and aboveSafari 1 and above Create Quiz Comment D divyatagoel0709 Follow 0 Improve D divyatagoel0709 Follow 0 Improve Article Tags : Web Technologies HTML HTML-Property Explore HTML BasicsHTML Introduction4 min readHTML Editors4 min readHTML Basics7 min readStructure & ElementsHTML Elements4 min readHTML Attributes7 min readHTML Headings3 min readHTML Paragraphs3 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks2 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables9 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms5 min readHTML5 Semantics5 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List15+ min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like