Javascript examples for CSS Style Property:top
Using negative values to Set the top position of a <div> element:
<!DOCTYPE html> <html> <head> <style> #myDiv {/*from w w w . j ava2 s.c o m*/ border: 1px solid #FF0000; position: relative; } </style> </head> <body> <div id="myDiv">This is a div.</div> <br> <button type="button" onclick="myFunction()">Set top position of div to -10 px</button> <script> function myFunction() { document.getElementById("myDiv").style.top = "-10px"; } </script> </body> </html>