RnD
RnD

Reputation: 1069

Scrolling in a div

As you can see in the image below, I have a red div at the size of the "screen", what I want to is to make content scrollable in that area only. Is there a way to do that?

enter image description here

The whole pad's css:

#mainWindow{
    margin-left:auto;
    margin-right:auto;
    background-image:url("../images/mainWindow.png");
    background-size:100% 100%;
    height:100%;
    width:80%;
    padding:55px 60px 95px 65px;
    box-sizing:border-box;
    position: relative;
}

Screen's css:

#screen{
    border:1px solid red;
    width:100%;
    height:100%;
}

Upvotes: 1

Views: 872

Answers (4)

user1720624
user1720624

Reputation:

#divID {
    overflow: scroll;
}

...might do the trick. If you need the parent element to not scroll, you could maybe set it like:

#divID {
    overflow: hidden;
}

Upvotes: 1

case1352
case1352

Reputation: 1136

The CSS tag you're looking for is 'overflow'

Upvotes: 0

Rick Calder
Rick Calder

Reputation: 18715

Set the overflow property of that div.

overflow:scroll;

Upvotes: 2

Kevin Boucher
Kevin Boucher

Reputation: 16695

Try adding overflow-y: scroll to your #mainWindow CSS declaration.

(Or alternatively to your #screen CSS declaration.)

Upvotes: 3

Related Questions