Is there a recommended way to determine the maximum height that a DIV can be set and remain visible per browser? This doesn't appear to be documented anywhere and is highly implementation specific.
For example, see the following test script:
http://jsfiddle.net/NP5Pa/2/
This is a simple test to find the maximum value you can set a DIV style height attribute before the corresponding clientHeight
of the element becomes 0. You can confirm this by clicking "Find Max" then incrementing the found height by 1 and clicking "Set Height".
Some examples (Win7/64):
Chrome (14.0) : 134,217,726 px
Safari (5.1) : 134,217,726 px
IE (9.0) : 10,737,418 px
FF (7.0.1) : 17,895,697 px
It's not surprising the WebKit produces the same result, I guess - more surprising that IE and FF are so different.
Is there a better way? And do you get different results in 32bit systems?
--EDIT: Updated the fiddle to stop at 10,000,000,000 (and get there quicker) for Opera. That's a lot of pixels.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…