html - div 中有一个表格不滚动

标签 html css overflow

我有一个包含在 div 中的表格。 表布局是固定的。 div 具有 css 属性“溢出:滚动”。 但是当我改变小于表格宽度的div时, 没有出现滚动条

最佳答案

指定一定的width,height给DIV然后overflow:auto;

overflow:auto;
width:500px;
height:400px;

检查这段代码

<style type="text/css">   
  .pqr{
    overflow:auto;
    width:500px;
    height:400px;
   }
</style>
<div class="pqr">
  <table width="600px" border="1">
    <tr>
      <td>
    Test
      </td>
    </tr>
  </table>
</div>

关于html - div 中有一个表格不滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3186409/

相关文章:

javascript - ajax提交表单为什么不能回显$_POST

javascript - 使用多个样式表

javascript - MDL 模态对话框在模态背景后面单击

javascript - 预渲染图像

html - 某些浏览器中的奇怪定位

javascript - jQuery 更改事件未正确触发

javascript - 为附加了 AJAX 的 div 创建一个 slider

html - Chrome ,溢出 : auto shows horizontal scroll bar whenever vertical scroll bar is shown

html - 固定位置表格标题超出屏幕

html - CSS 溢出-x :hidden doesn't work on mobile