我想向我的html動態表格垂直添加滾動條。我已將表格放入div中,但似乎沒有工作。請幫助將滾動條垂直添加到表格
這是我的HTML代碼
<thead>
<tr>
<td colspan="5">
<div class="scrollit">
<th><span>ID</span></th>
<th><span>Name</span></th>
<th><span>Location</span></th>
<th><span>Date</span></th>
<th><span>Catagory</span></th>
</div>
</td>
</tr>
</thead>
PHP代碼
print "<tr>";
print "<td>";
print "<div>";
print "<td >" . $row['ID'] . "</td>";
print "<td >" . $row['Name'] . "</td>";
print "<td >" . $row['Location'] . "</td>";
print "<th >" . $row['Date'] . "</th>";
print "<td >" . $row['Category'] . "</td>";
print "</div>";
print "</td>";
print "</tr>";
}
print "</table>";
CSS代碼:
.scrollit {
overflow:scroll;
height:100px;
}
順便說一句,我從數據庫中檢索數據表。
給予更新的摘要上課到喲你的div在PHP代碼 – Bhavik
你需要看看這個。 http://stackoverflow.com/questions/8232713/how-to-display-scroll-bar-onto-a-html-table –