0

I have a box with content-based width (position: absolute). But "overflow-y: auto" inserts a scrollbar that doesn't make container wider unlike the "overflow-y: scroll". I need auto overflow and auto width including scrollbar. Is there a solution?

.container {
    position: absolute;
    max-height: 100px;
    overflow-y: auto;
}

http://jsfiddle.net/mw552cxf/

2 Answers 2

1

try to add overflow: hidden; to each item :

.item {
    border: 1px solid blue;
    overflow: hidden;
}

Edit : ok so the solution who sweets your need wold be this , use word-wrap:

.item {
    border: 1px solid blue;
    word-wrap: break-word;
}

Live Demo

Live Demo 2nd solution

Sign up to request clarification or add additional context in comments.

2 Comments

Then their content is cut
Breaking words doesn't suit me :)
0

How about adjusting the width of .container in the CSS?

1 Comment

No, i need dynamic content-based width

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.