I have a div that I am displaying many things in that are related to laptop for filtering data. The div increases it's size as the data size increases in it.
I want the div to remain at a max size of 450px then if data increases scroll will come automatically. The div size should not be increased.
jsfiddle for it.
css :
.itemconfiguration { min-height:440px; width:215px; /* background-color:#CCC; */ float:left; position:relative; margin-left:-5px; } .left_contentlist { width:215px; float:left; padding:0 0 0 5px; position:relative; float:left; border-right: 1px #f8f7f3 solid; /* background-image:url(images/bubble.png); */ /* background-color: black; */ }
Can anyone help me achieve this?
For vertical scrollable bar use the x and y axis. Set the overflow-x:hidden; and overflow-y:auto; that will automatically hide the horizontal scroll bar and present only vertical scrollbar. Here the scroll div will be vertically scrollable.
We can use a combination of overflow-x and overflow-y to place the scrollbar vertically, horizontally, or both. For the vertical scrollbar, overflow-x:hidden and overflow-y:auto will be set in the CSS file, and vice versa for the horizontal scrollbar.
The scrollbar can be triggered with any property overflow , overflow-x , or overflow-y and each can be set to any of visible , hidden , scroll , auto , or inherit .
We set the height of the table element to 120px to make restrict the height of it so we can make it scrollable. To make it scrollable, we set the overflow CSS property to scroll . Then we set the tr elements in the thead to absolute position so they stay in place.
Use overflow-y:auto
for displaying scroll automatically when the content exceeds the divs set height.
use overflow:auto
property, If overflow is clipped, a scroll-bar should be added to see the rest of the content,and mention the height
DEMO
.itemconfiguration { height: 440px; width: 215px; overflow: auto; float: left; position: relative; margin-left: -5px; }
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