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
Removes the default margins
<html>
<head>
<title>TAG index</title>
<style type="text/css">
body {
margin: 0;
padding: 0; /* Settings for Opera */
}
</style>
</head>
<body>
</body>
</html>