table auto height 100%


因為在某些情況下要使用到 table,所以花了點昤間來研究.
結果在 IE8, Chrome, FireFox 3.6 都測試成功了,記錄一下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>x</title>
<style type="text/css">
* { border: none; padding: 0; margin: 0; z-index:0; }
body, html { height: 100%; }
#wapper { height:100%; min-height:100%; width: 100%; background-color:#000; color: #FFF; }
</style>
</head>
<body>
<div id="wapper">
<table width="100%" height="100%">
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
</tr>
</table>
</div>
</body>
</html>