IE10中的高度100%问题。在IE和所有其他浏览器中以Quirks模式运行

时间:2013-05-21 20:05:53

标签: javascript html css

请参阅以下页面:

http://www.judsondesigns.com/Demos/jscroller/index.html

如果您在IE中注意到它会导致滚动。其他所有浏览器都可以。为什么IE导致滚动?我该如何解决这个问题?

由于

贾德森

这是我正在使用的代码:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<style>
html, body{ 

    height:100%; 
    width: 100%;
    margin: 0px;
    padding: 0px;

 }

</style>
</head>

<body>
<div style="display:table; width: 100%; height:100%;">
<div style="display: table-row; background: red">test</div>
<div style="display: table-row">
        <div style="display: table-cell; height:100%; width:100%;overflow: hidden ">
            <div style=" height:100%; width:100%; overflow:hidden; background: #06F">test123
            </div>
        </div>
</div>
<div style="display:table-row; background: red;">test</div></div>
</div>
</body>
</html>

图片正常的IE10模式: Screen Shot of scrolling issue in IE

并且在Quirks模式下(我需要它看起来如何) Screen Shot of Quirks mode in IE

2 个答案:

答案 0 :(得分:1)

您应在margin-bottom上设置一个否定div,其中test123文本的值高于底部table-row的高度。您可以将其设置为-100%以确保安全,这将在IE中修复它,并且不会在任何其他浏览器中破坏它。

这是 jsFiddle

答案 1 :(得分:0)

<div style="width: 100%; height: 100%; display: table; max-height: 100%;">
<div style="background: red; height: 2%; display: table-row;">test</div>
<div style="display: table-row;">
        <div style="width: 100%; height: 96%; overflow: hidden; display: table-cell; max-height: 100%; background-color: blue;">
            <div style="width: 100%; height: inherit; color: green; display: table;">test123456
 asdfasdfasdf           </div>
        </div>
</div>
<div style="background: red; height: 2%; display: table-row;">test</div></div>

这对我有用

相关问题