Copyright © tutorialspoint.com
The margin-top property sets the width of the margin on the top of an element.
All the HTML elements
object.style.marginTop="5px" |
Here is the example:
<p style="margin-top: 15px; border:1px solid black;"> This is a paragraph with a specified top margin </p> <p style="margin-top: 5%; border:1px solid black;"> This is another paragraph with a specified top margin in percent </p> |
This will produce following result:
This is a paragraph with a specified top margin This is another paragraph with a specified top margin in percent |
To Become more comfortable - Do Online Practice
Copyright © tutorialspoint.com