悬赏分:200 浏览:714 次
<html>
<head>
<meta http-equiv="Content-Language" content="zh-tw">
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>Table 排版</title>
</head>
<body style="width:100%; height:100%; margin: 0; padding: 0;">
<table border="1" id="table1" style="width:100%; height:100%">
<tr style="height:20px; background-color: #008000">
<td> </td>
</tr>
<tr>
<td>
<div style="min-height:100%; width:100%; overflow:auto; height:100%;">
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
</div>
</td>
</tr>
<tr style="height:20px; background-color: #008000">
<td> </td>
</tr>
</table>
</body>
</html>
|
给你这个代码。这个问题的原因是:firefox会优先min-height属性造成的。
还有你的页面没有设置文档类型,这是不好的习惯。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>new document</title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
</head>
<body>
<table border="1" id="table1" style="width: 100%; height: 100%">
<tr style="height: 20px; background-color: #008000">
<td> </td>
</tr>
<tr>
<td>
<div style="height: 100px; width: 100%; overflow-y: auto; border: 1px solid red;">
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
<p>這是DIV</p>
</div>
</td>
</tr>
<tr style="height: 20px; background-color: #008000">
<td> </td>
</tr>
</table>
</body>
</html>
如果不熟CSS或操作困难的话可以考虑使用JS来调整. |
|
9个月前 jeff377 : To. 杨正祎 謝謝你的答覆,不過你的答案還是無法達到我的需求。 中間的 td 需要依頁面的大小自動調整,不是固定大小。 |