overflow: auto The auto value is similar to scroll , but it adds scrollbars only when necessary: You can use the overflow property when you want to have better control of the layout. The overflow property specifies what happens if content overflows an element's box.
As for preventing scrolling on the div, all you need to apply on the footer is overflow: hidden; and that should do the trick. Actually margin:0 auto; is not going to help with position:absolute;.
Use overflow: auto
. Scrollbars will only appear when needed.
(Sidenote, you can also specify for only the x, or y scrollbar: overflow-x: auto
and overflow-y: auto
).
try this:
<div style='overflow:auto; width:400px;height:400px;'>here is some text</div>
try
<div style='overflow:auto; width:400px;height:400px;'>here is some text</div>
try
<div id="boxscroll2" style="overflow: auto; position: relative;" tabindex="5001">
Change overflow property of CSS block
to auto
.
overflow: auto;
It will automatically add a scrollbar to the left only when needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With