Make div scrollable

后端 未结 7 1240
梦谈多话
梦谈多话 2020-12-28 13:18

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

相关标签:
7条回答
  • 2020-12-28 13:19

    Place this into your DIV style

    overflow:scroll;
    
    0 讨论(0)
  • 2020-12-28 13:19

    You should add overflow property like following:

    .itemconfiguration
        {   
            height: 300px; 
            overflow-y:auto;
            width:215px;
            float:left;
            position:relative;
            margin-left:-5px;
        }
    
    0 讨论(0)
  • 2020-12-28 13:28

    You need to remove the

    min-height:440px;
    

    to

    height:440px;
    

    and then add

    overflow: auto;
    

    property to the class of the required div

    0 讨论(0)
  • 2020-12-28 13:30

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

    See this demo

    0 讨论(0)
  • 2020-12-28 13:41

    I know this is an older question and that the original question needed the div to have a fixed height, but I thought I would share that this can also be accomplished without a fixed pixel height for those looking for that kind of answer.

    What I mean is that you can use something like:

    .itemconfiguration
    {
        // ...style rules...
        height: 25%; //or whatever percentage is needed
        overflow-y: scroll;
        // ...maybe more style rules...
    }
    

    This method works better for fluid layouts that need to adapt to the height of the screen they are being viewed on and also works for the overflow-x property.


    I also thought it would be worth mentioning the differences in the values for the overflow style property as I've seen some people using auto and others using scroll:

    visible = The overflowing content is not clipped and will make the div larger than the set height.

    hidden = The overflowing content is clipped, and the rest of the content that is outside the set height of the div will be invisible

    scroll = The overflowing content is clipped, but a scroll-bar is added to see the rest of the content within the set height of the div

    auto = If there is overflowing content, it is clipped and a scroll-bar should be added to see the rest of the content within the set height of the div

    0 讨论(0)
  • 2020-12-28 13:42

    use css overflow:scroll; property. you need to specify height and width then you will be able to scroll horizontally and vertically or either one of two scroll by setting overflow-x:auto; or overflow-y:auto;

    0 讨论(0)
提交回复
热议问题