Grow your CSS skills. Land your dream job.

Scrolling div within div

  • # January 13, 2012 at 1:54 pm

    I am trying to make a div, then have another div contained with the parent div which has a determined height. But when doing this, the right scroll bar goes beyond the height of the containing div. How can I fix this? Here is the link: Click Here

    # January 13, 2012 at 2:36 pm

    I think you need to make the height on the scrollable div smaller than 100%. It can’t take up 100% of the parent container because of the other content within it. I just kind of guessed on how the height would be through trial and error to get the scroll bar to fit. Try this code:



    .scrollable {
    height: 69%;
    overflow: auto;
    }


    # January 13, 2012 at 2:44 pm

    I started playing with it more, and saw that is what I had to do. But my thought process was, 100% meant it would take up 100% of what ever space was remaining. But then when thinking with widths, it is always whatever percentage of the parent value so makes sense it would work the same way of course. I deal with widths more the height usually.

    Thanks.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".