我是html的新手,而css,我的.htm文件看起来像这样:
<HTML>
<table border="0" height="406px" ID="Table1"
style="WIDTH: 725px; HEIGHT: 406px">
<tr>
<td width="372px" height="20px" valign="top"><img src="StarsStartPage_SEET_1_1.png"
style="clip: rect(50px, 50px, 50px, 20px);"></td>
<td width="480px" valign="top" height="20px"><FONT size="1" face="Arial">
<P><br> </P>
<P> </P>
<P> </P>
</FONT>
<table ID="Table2" border="0" bordercolor="white" width="443" height="52px" cellspacing="0"
cellpadding="2" style="WIDTH: 360px">
<tr>
<td id="openproject" width="100%" align="left" valign="middle">
<A href="urn:$$newproject"><IMG src="NewProject_Normal.png" height="36" width="155" border="0" style="Z-INDEX: 0"></A>
<font face="Arial" size="4" color="white">=</font>
<A href="urn:$$close"><IMG src="Continue_Normal.png" height="36" width="155" border="0" align="top"></A>
</td>
</tr>
</table>
<p style="MARGIN-RIGHT: 0px; width: 360px;" dir="ltr"><font face="Arial" size="4" color="black"> Recently used Projects:<br></font></p>
<table ID="plist" border="0" height="0" cellspacing="0" datasrc="#clicklist"
style="WIDTH: 360px; HEIGHT: 26px, overflow:auto">
<tr>
<td id="projline" width="100%" align="left" valign="middle" style="margin-left: 16px;"><font size="3" face="Arial">
<a id="proj" href="urn:a"><span datafld="Name"
style="padding-left: 20px; line-height: 26px;"></span></a></font>
</td>
</tr>
</table>
<table ID="plistgrey" border="0" height="0" cellspacing="0" datasrc="#greylist"
style="WIDTH: 360px; HEIGHT: 26px">
<tr>
<td id="projlinegrey" width="100%" align="left" valign="middle"><font size="3" face="Tahoma" color="DimGray">
<span style="margin-left: 20px;" datafld="Name"></span></font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</BODY>
如何将滚动条专门添加到表格表格ID =&#34; plist&#34;?我试过这一行:style =&#34; WIDTH:360px;高度:26px,溢出:自动&#34;&gt;但它没有用。我应该把它改成div风格吗?
答案 0 :(得分:1)
添加溢出-y:滚动如果你想在你的div中有一个滚动条并添加一个小于你的div的高度
CSS:
#plist{
height:100px;
overflow-y:scroll;
}
答案 1 :(得分:1)
您必须将表格包装在div
元素中才能使其正常工作:
#list-wrapper{
height: 150px; // For demo purposes, limit the height of the div
overflow-y: scroll;
}
<div id="list-wrapper">
<table>
...
</table>
<div>
另外,你的标记非常破碎,但我现在找不到什么问题,你应该解决这个问题,如果你挣扎,请打开另一个问题。