margin: ***;

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O

The margin property sets the margins around an element.

The margins of the table can be set by applying this property to the TABLE element.


table {
margin: 5px;
}

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

Example

The right and bottom margins : 20px

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

<style type="text/css">

#example {
width: 100%;
}

table, td, th {
border: 2px #2b2b2b solid;
}

table {
width: 200px;
float: left;
margin: 0 20px 20px 0;
}

</style>

</head>
<body>

<div id="example">

<table>
<tr>
<th>Heading A</th>
<th>Heading B</th>
</tr>
<tr>
<td>Cell A</td>
<td>Cell B</td>
</tr>
<tr>
<td>Cell C</td>
<td>Cell D</td>
</tr>
</table>

<p>
Some text Some text.<br>
Some text Some text ...
</p>

</div>

</body>
</html>

Output
Heading A Heading B
Cell A Cell B
Cell C Cell D

Some text Some text.
Some text Some text.
Some text Some text.
Some text Some text.
Some text Some text.
Some text Some text.
Some text Some text.
Some text Some text.
Some text Some text.
Some text Some text.
Some text Some text.
Some text Some text.