Javascript examples for CSS Style Property:right
The right property sets or gets the right position of a positioned element.
Value | Description |
---|---|
auto | browser decides the right position. Default |
length | right position in length units. Negative values are allowed |
% | right position in percentage?of the width of the parent element |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
Item | Value |
---|---|
Default Value: | auto |
Return Value: | A String, representing the right position of a positioned element |
CSS Version | CSS2 |
Set the right position of a <div> element:
<!DOCTYPE html> <html> <body> <div id="myDiv" style="position:absolute;right:15px;">This is a div element.</div> <button type="button" onclick="myFunction()">Test</button> <script> function myFunction() {/*from w w w . ja v a 2s .c o m*/ document.getElementById("myDiv").style.right = '20px'; } </script> </body> </html>