Using negative values - Set the top position of a <div> element:
document.getElementById("myDiv").style.top = "-10px";
<!DOCTYPE html> <html> <head> <style> #myDiv {/* ww w.j a v a2 s .co 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>