javascript margin property
Translation results:
英[ˈmɑ:dʒɪn] US[ˈmɑ:rdʒən]
##n. Edge, range; limit; profit, surplus; (outside the center of the plate) blank vt. Leave a margin ; Become the side of...; add an edge to, surround; add margins to...Plural: marginsjavascript margin propertysyntax
Function: Set the margins of the element.
Syntax: Object.style.margin=margin
javascript margin propertyexample
<html> <head> <script type="text/javascript"> function changeMargin() { document.getElementById("p1").style.margin="100px"; } </script> </head> <body> <input type="button" onclick="changeMargin()" value="Change margins of a paragraph" /> <p id="p1">This is a paragraph</p> </body> </html>
Run instance »
Click the "Run instance" button to view the online instance