'top' Example : top « CSS Attributes and Javascript Style Properties « HTML CSS Reference






'top' Example

    
<html>
<body>
<p>
<center>
<img id="myImg" 
     src="http://www.java2s.com/style/logo.png" 
     width=74 height=100" 
     style="position:relative">
</p>
</center>
<input type="button" value="Set top property to 100" onclick="myImg.style.top=100">
<input type="button" value="Set top property to 200" onclick="myImg.style.top=200">
<input type="button" value="Restore image position" onclick="myImg.style.top=0">
</body>
</html>

    
      
      








Related examples in the same category

1.'top' Syntax and Note
2.'top' Possible Values
3.'top' is applied to