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)


div {
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


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

<style type="text/css">

p {
background-color: #85b9e9;
margin-left: 50px;
margin-right: 50px;
}

</style>

</head>
<body>

<p>The left and right margins: 50px</p>

</body>
</html>

Output

The left and right margins: 50px