html - 将滚动条添加到 HTM 文件中的特定表格

标签 html css scrollbar

我是 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>&nbsp;</P>
                    <P>&nbsp;</P>
                    <P>&nbsp;</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>&nbsp;
                            <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">&nbsp;&nbsp;&nbsp;&nbsp;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>

如何专门给表格table ID = "plist"添加一个滚动条?我尝试了这一行:style="WIDTH: 360px; HEIGHT: 26px, overflow:auto"> 但它没有用。我应该将其更改为 div 样式吗?

最佳答案

如果你想在你的 div 中有一个滚动条并添加一个小于你的 div 的高度,请添加 overflow-y:scroll

CSS:

#plist{
  height:100px;
  overflow-y:scroll;
}

关于html - 将滚动条添加到 HTM 文件中的特定表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35648422/

相关文章:

javascript - 取消内联 Onclick 的浏览器滚动重置

html - 将行添加到 style.css

javascript - 使用 JavaScript 更改元素上的 CSS 类,无需 FOUC

html - Bootstrap 下拉 li 自定义不起作用

html - 通过向右浮动对齐 Div

c++ - 滚动大图像故障的 MSDN 示例

javascript - AngularJS Http Post 到 API

html - div 的 CSS3 变换比例导致在 Firefox 中跳跃子元素

css - 围绕居中的品牌形象包装 Bootstrap 导航栏列表项

apache-flex - Flex - 将滚动条的位置更改为 Horizo​​ntalList 组件的顶部