问题
Quick question about overflows. I'm working on this page
http://www4.wittenberg.edu/admission_dev/undergrad/ 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. Any help would be appreciated!
Ben
回答1:
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/
回答2:
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%;
}
来源:https://stackoverflow.com/questions/8447782/css-overflow-allow-horizontal-scroll