简体   繁体   English

IE 中的滚动条正在工作,但在 chrome 中没有

[英]scrollbar in IE is working but not in chrome

i have a table like below where the scrollbar is working in IE 11 with scroll=yes, but the same is not working in Chrome.Any suggestion or help would be appreciated.我有一个如下表,滚动条在 IE 11 中使用 scroll=yes 工作,但在 Chrome 中同样不起作用。任何建议或帮助将不胜感激。 thank you.谢谢你。

 table, td { border: 1px solid black; border-collapse: collapse; padding: 5px; text-align: left; }
 <body scroll="yes" scrolling="yes"> <table style="width:100%"> <tr> <td width="25%"><label>name </label></td> <td width="75%"><input type="text"></td> </tr> <tr> <td width="25%"><label>last name </label></td> <td width="75%"><input type="text"></td> </tr> <tr> <td width="25%"><label>middle name </label></td> <td width="75%"><input type="text"></td> </tr> <tr> <td width="25%"><label> name </label></td> <td width="75%"><input type="text"></td> </tr> </table>

Neither of those attributes on the body element are supported in anything other than Internet Explorer.除了 Internet Explorer 之外,其他任何东西都不支持 body 元素上的这些属性。 In fact, the Mozilla Developer Network website doesn't list it as an attribute: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body事实上,Mozilla Developer Network 网站并没有将其列为属性: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body

I would recommend doing it in css instead using overflow , overflow-x or overflow-y我建议在 css 中执行此操作,而不是使用overflowoverflow-xoverflow-y

Simply add overflow-y:auto to your body tag and that should work.只需将overflow-y:auto添加到您的 body 标记中即可。 (or overflow-y:scroll ) (或overflow-y:scroll

 table, td { border: 1px solid black; border-collapse: collapse; padding: 5px; text-align: left; }
 <body scroll="yes" scrolling="yes" style='overflow-y: auto;'> <table style="width:100%"> <tr> <td width="25%"><label>name </label></td> <td width="75%"><input type="text"></td> </tr> <tr> <td width="25%"><label>last name </label></td> <td width="75%"><input type="text"></td> </tr> <tr> <td width="25%"><label>middle name </label></td> <td width="75%"><input type="text"></td> </tr> <tr> <td width="25%"><label> name </label></td> <td width="75%"><input type="text"></td> </tr> </table>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM