td padding:20px; : td padding « Tags « HTML / CSS






td padding:20px;

    

<?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 cell padding
2.Cell padding
3.Set margin and padding for td tag
4.td padding-left: 11px;
5.td padding-right: 11px;
6.td padding: 0; margin: 0;
7.td padding: 5px;
8.td padding: 2px;
9.td padding: 7px;
10.td, th, caption padding: 5px;