Nojan
Nojan

Reputation: 913

how to isolate the content in Div

as we know, the content of a fixed-size div will go out of the div, in case they need more space. ex : http://jsfiddle.net/YaTeG/ now my question is how to stop it without any js ? i mean like an iframe ! which has scrollbars if we need more space.

Upvotes: 1

Views: 284

Answers (3)

skip405
skip405

Reputation: 6279

overflow property controls both scrollbars horizontal and vertical. If you want further control, you can set the overflow property separately for each scrollbar.

overflow-x property controls the horizontal scrollbar and overflow-y - for the vertical

e.g.

.some_element{
    overflow-x: hidden;
    overflow-y: auto;
}

Upvotes: 1

Hüseyin BABAL
Hüseyin BABAL

Reputation: 15550

If you update your css like this;

#wrapper {
    position: absolute;
    width: 200px; height: 200px;
    top: 20px; left: 20px;
    background-color: #ff0;
    border: 2px solid #000;
    overflow:auto;
}

it will autoscroll authomaticallywhen your content is bigger than div.

overflow:auto;

You can have look at here for different style of this case

Upvotes: 1

rid
rid

Reputation: 63442

Use the overflow property.

  • overflow: hidden if you want it to be cut, or
  • overflow: auto if you want scrollbars to appear in case the content is too long.

Upvotes: 3

Related Questions