Why doesn’t div with id “shouldHaveScrollBar” doesn’t display a horizontal scrollbar:
<div style="overflow:hidden;
width: 300px; height: 300px; background-color:blue; color:white">
<div>Some stuff</div>
<div>Some other stuff"</div>
<div id="shouldHaveScrollBar"
style="background-color:grey;
width: 100%; height: 100%; overflow-x:auto">
<input type="text" size=200">
</div>
</div>
Thank you,
Because your horizontal scroll bar is hidden in the y-overflow.
shouldHaveScrollBaris set to 100% height, which is 100% of it’s parent, so it is 300px in height. Unfortunately, the other 2 divs “Some stuff”, etc, push it down, meaning that your scroll bar at the bottom is hidden by theoverflow:hiddenof your parent div.Change the height of
shouldHaveScrollBarto 50% and you will see what I mean. Your height should probably be a fixed pixel height instead of a percentage in this case, or your other divs need to be set as percentages such that the total of your child divs is <= 100%.