table margin:15px; : table margin « Tags « HTML / CSS






table margin:15px;

     

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>A CSS Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type='text/css'>
body {font-family:arial, verdana, sans-serif;}

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

table{margin:15px;}
th, td{padding:20px;} 
</style>


</head>

<body>
<p>This example shows how whitespace can make a page much easier to read. It is not Strict XHTML 1.0 beacuse it does not use a &lt;p&gt; element to contain the text here before and after the table. The following table contains some test text to make a point.</p>
<table>
  <tr>
    <td>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit</td>
    <td>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit</td>
  </tr>
</table>
<p>If the &lt;p&gt; element were used the browser would likely add in some whitespace by itself. There is also real improvement, however, from adding padding to the &lt;td&gt; and &lt;th&gt; elements.</p>
</body>
</html>

   
    
    
    
    
  








Related examples in the same category

1.table margin-top: 15px;
2.table margin-bottom: 25px;
3.table with margins
4.table margin: 0 0 16px;
5.table margin-bottom: 5px;
6.Set margin for select inside a table