margin-***: ***;

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O

The margin-*** property sets the top, bottom, left, and right margins of an element.
(*** = top, bottom, left, and right)

Applying this property to the BODY element applies the specified style to an entire page.


body {
margin-top: 5px;
margin-right: 10px;
margin-bottom: 15px;
margin-left: 20px;
}

Property Value Explanation
margin-top length, %, or auto the top margin
margin-right length, %, or auto the right margin
margin-bottom length, %, or auto the bottom margin
margin-left length, %, or auto the left margin

Example

Setting the horizontal margins to 50px

<html>
<head>
<title>TAG index</title>

<style type="text/css">

body {
margin-left: 50px;
margin-right: 50px;
padding: 0; /* Settings for Opera */
}

</style>

</head>
<body>



</body>
</html>

Output
Example pagenew window