Div的高度大于一定数值后,IE8自动调整其高度为一固定值_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:35:47
Original
1572 people have browsed it

<div style="height: 200px; width: 100%; overflow: auto; position: relative;" id="div1">	<div style="height: 2000000px; width: 1000px;" id="hugeDiv">	</div>	XXXXXXXXXX</div>
Copy after login


高度被设置为2000000px,在IE8中查看的时候始终是:height: 1342177.27px;
被变成了:

FF和chrome都没这个问题
大家能解释下这是为什么不?该怎么处理?


回复讨论(解决方案)

<!DOCTYPE HTML><html lang=""><head>	<meta charset="gbk">	<title></title></head><body>	<div style="height: 200px; width: 100%; overflow: auto; position: relative;" id="div1">		<div style="height: 2000000px; width: 1000px;" id="hugeDiv"></div>		XXXXXXXXXX	</div>	<script type="text/javascript">		alert( document.getElementById('hugeDiv').offsetHeight )	</script></body></html>
Copy after login


没问题啊

HTML code








应该就是个显示上限的问题吧
比如
<!DOCTYPE HTML><html lang=""><head>    <meta charset="gbk">    <title></title></head><body>    <div style="height: 200px; width: 100%; overflow: auto; position: relative;" id="div1">        <div style="height: 123456789px; width: 1000px;" id="hugeDiv"></div>        XXXXXXXXXX    </div>	<div id="test"></div>    <script type="text/javascript">        document.getElementById('test').innerHTML = document.getElementById('hugeDiv').offsetHeight;    </script></body></html>
Copy after login


这里 ff 直接 显示0, ie6 显示123456789,ie8 显示1193046

而改成 12345678,
那么ff和ie6显示 12345678, ie8依然是1193046

改成  然后 滚动条的高度并非真实的1,193,046 px, 如果是真的那么高,拉滚动条岂不是要拉哭?

具体 DOM的高度上限是多少没研究过。

正需要

应该就是个显示上限的问题吧
比如
HTML code

nbsp;HTML>


    
    


    
我也偏向于认为是个显示上限的问题。想找到一些比较官方的文档看看,不知可否推荐一些关于浏览器方面的书籍?
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template