Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make div scrollable

Tags:

html

css

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?

like image 725
user3145373 ツ Avatar asked Jan 20 '14 06:01

user3145373 ツ


People also ask

How do you make a div content scrollable?

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.

How do I make a div scrollable vertically and horizontally?

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.

Can div have 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 .

How do you make a scrollable body in HTML?

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.


2 Answers

Use overflow-y:auto for displaying scroll automatically when the content exceeds the divs set height.

See this demo

like image 95
Zword Avatar answered Oct 25 '22 01:10

Zword


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;     } 
like image 29
Manoj Avatar answered Oct 25 '22 00:10

Manoj