I'm having problems with scrollbars on an element with position: absolute . The behavior I am experiencing is that chrome 21 and firefox 15 display scrollbars inside the field, resizing it, thereby hiding part of the text, however Opera 12 and Internet explorer 9 also displays it inside, but without resizing the content and resizing the field instead (this, in my opinion, is correct, since the field does not have a certain width). Is there any solution to make this the same in these four browsers?
JsFiddle: http://jsfiddle.net/Kukkimonsuta/GaMD7/2/
Edit: as Shiva Charan pointed out, it works correctly when overflow-y is set to “scroll”, however it always shows a scroll bar that is not needed
Edit: my final decision based on Siva Charan answers and anonymous vote is lame
http://jsfiddle.net/Kukkimonsuta/GaMD7/15/
function updateAutoScroll(element) { var $element = $(element); if (element.scrollHeight > element.clientHeight) $element.css("overflow-y", "scroll"); else $element.css("overflow-y", "auto"); }
css
Lukáš Novotný
source share