<html>
<head>
<style>
#myDiv {
border: 1px solid #FF0000;
}
</style>
</head>
<body>
<div id="myDiv">This is a div.</div>
<br>
<button type="button" onclick="myFunction()">Set top margin</button>
<script>
function myFunction() {
document.getElementById("myDiv").style.marginTop = "50px";
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_style_margintop by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:39:52 GMT -->
</html>