Tuesday, 15 February 2011

html - Strange behavior of scrollHeight in firefox on div with padding and overflow:auto -



html - Strange behavior of scrollHeight in firefox on div with padding and overflow:auto -

here is, http://jsfiddle.net/ynkws/

<div id="div1" style="padding: 2px; overflow: auto;"> <div style="height:30px;">lalala</div> <div style="height:30px;">lalala</div> </div> var d = $("#div1"); (var = 0; < 5; i++) { console.log(d.height(),d[0].scrollheight); d.height(d.height() - 1); }

there's div padding , overflow:auto. , in firefox there's unusual behavior of div's scrollheight value. when set div's height smaller it's original height, that's natural expect scrollbar appears , scrollheight value remains same. chrome suits theese expecatations not firefox, lastly 1 doesn't draw scrollbar, decreases bottom padding , scrollheight when deviation of original height smaller div's padding.

is bug , there prepare of 'bug'?

the firefox behavior 1 css spec requires: padding on thing overflow doesn't cause overflow on own.

html firefox scrollbar padding

No comments:

Post a Comment