【问题标题】:div has a table in it does not scrolldiv 里面有一个表不滚动
【发布时间】:2011-03-12 07:31:34
【问题描述】:

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

【问题讨论】:

    标签: html css overflow


    【解决方案1】:

    将某些widthheight 指定为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>
    

    【讨论】:

    • 感谢您的回复 Salil。我已经尝试过“溢出:自动”,它在 FF 和 IE 中都不起作用:C 我将发布我的代码。
    • 是的!它有效。但我的表格宽度设置在
      测试
    • 对不起,我是新来的。我不知道如何发布像你这样的代码。对不起我的英语不好:D
    • 什么是col?你为什么需要那个?只需使用
    猜你喜欢
    • 2018-09-16
    • 2012-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-01
    • 2018-01-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多