8

I'm working on this page and I'm trying to get the overflow to allow for horizontal scrolls. I've tried setting the body to hidden and the class "real body" to auto. This doesn't seem to work.

1

3 Answers 3

14

you need to wrap your long content div with a position: relative; overflow: auto div.

which i something like this:

.wrapper {
  position: relative;
  overflow: auto;
}

.content {
  position: absolute;
  width: 30000px;
}

for a better example, please check http://jsfiddle.net/wXqPv/

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

3 Comments

Plus 1. The reason this works is because of the definite width.
so setting width to auto should work when the horizontal content is added?
Does this still work now? the demo doesn't work for me
1

The code below worked for me. Make sure to include it in the parent not the actual element itself.

.parent {
  white-space: nowrap;
}

Comments

0

You can use this code with slide changes of above one:

.wrapper {
    position: relative;
    width: 200px;
    height: 100px;
    outline: 1px solid lime;
    overflow-x: auto;
}
.longcontent {
   position: absolute;
   width: auto;
   height: 100%;
}

Comments

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.