css - overflow allow horizontal scroll

怎甘沉沦 提交于 2019-12-22 05:25:56

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!