我想要一個表頭,在一個單獨的div留在地方,而div undernearth是能夠滾動記錄的列表。兩者的div是一個div命名圖層3 Hereis我使用的CSS文件:我使用生成HTML的PHP代碼的固定標題以上滾動表
#Layer3
{
position:absolute;
width: 89%;
height: 40%;
left: 10%;
top: 56%;
background-color: #f1ffff;
}
#Layer3 h1 {
font-size: medium;
color: #000033;
text-decoration: none;
text-align: center;
}
.tableheader {
}
.tablecontent {
overflow: auto;
}
和部分:
echo '<div id="tableheader" class="tableheader">';
echo "<h1>{$query} Auctions</h1>" . "\n";
echo "</div>";
echo '<div id="tablecontent" class="tablecontent">';
echo "<table border='0' width='100%'><tr>" . "\n";
echo "<td width='15%'>Seller ID</td>" . "\n";
echo "<td width='10%'>Start Date</td>" . "\n";
echo "<td width='75%'>Description</td>" . "\n";
echo "</tr>\n";
// printing table rows
foreach ($rows as $row)
{
$pk = $row['ARTICLE_NO'];
echo '<tr>' . "\n";
// table contens generated in here
echo '</tr>' . "\n";
}
}
echo "</div>";
我不知道我錯過了什麼,但是tableheader看起來並不固定,甚至與tablecontent分開。
我已經指出了溢出:auto並且它正在生成滾動條,即使我h沒有指定高度,但表頭與它滾動,我不明白的東西 – 2009-01-23 14:47:10