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 |
The vertical margins : 20px, The horizontal margins : 40px
<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: 20px 40px; } </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>
| 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.