【问题标题】:Content expands vertically in IE but has a scrollbar in Firefox内容在 IE 中垂直扩展,但在 Firefox 中有滚动条
【发布时间】:2011-07-12 14:12:39
【问题描述】:

在我的弹出窗口中,我已经固定了大小,如果内部内容较大,应该有一个垂直滚动条,它在 Firefox 中工作正常(虽然我只想要垂直滚动条)但在 IE 中不起作用(使用 IE 8 )。下面是图片。可能是什么问题?

我的 CSS 代码

#compareParentDiv
{ 
overflow-y: auto;
//overflow-x: hidden; 
max-height: 380px;
width:100%
} 

我的分区

$('#compareContent').empty();
    $('<div id="compareParentDiv" width="100%">'+
      '<table id="list2" cellspacing="0" cellpadding="0"></table>'+
            '<div id="gridpager2"></div></div>')
    .appendTo('#compareContent');

【问题讨论】:

  • 您可以将“overflow: auto”设置为要添加滚动条的div。
  • @Michas:它适用于 chrome 和 firefox,但不适用于 IE

标签: javascript jquery css internet-explorer cross-browser


【解决方案1】:

查看overflow-y:scrolloverflow-y:auto,将其应用于应滚动的元素。

如果设置为scroll,滚动条始终可见,如果设置为auto,则取决于浏览器,但我相信所有浏览器都会在需要时提供滚动条,否则不会。

【讨论】:

  • 我之前加过overflow-y:auto,但在IE中没有运气。检查我的代码(更新)
  • 如何禁用水平滚动?
猜你喜欢
  • 2018-08-17
  • 2012-04-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-17
  • 1970-01-01
相关资源
最近更新 更多