margin: ***;

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O

The margin property sets the margins around an element.

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


body {
margin: 5px 10px 15px 20px;
}

Property Value Explanation
margin length, %, or auto the top, bottom, left, and right margins
  • margin: 2px; : [all sides] margins
  • margin: 2px 4px; : [top, bottom] [left, right] margins
  • margin: 2px 4px 6px; : [top] [left, right] [bottom] margins
  • margin: 2px 4px 6px 8px; : [top] [right] [bottom] [left] margins

Example

Removes the default margins

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

<style type="text/css">

body {
margin: 0;
padding: 0;
}

</style>

</head>
<body>



</body>
</html>

Output
Example pagenew window

(Default examplenew window)