css - 修复网页中的水平滚动

标签 css html scroll

I am currently working on a side project and i ran into something annoying: When my browser size is smaller than around (1280 | something) the content is not entirely viewable. I can scroll to the right to see whats there, but not to the left.

html:

<div id="wrapper">
 [...]
</div>

CSS:

#wrapper {
 position: absolute;
 width: 1200px;
 margin-right: -600px;
}

最佳答案

你的居中技术是错误的。

使用:

#wrapper {
  margin-left:auto;
  margin-right:auto;
  width: 1200px;
}

此外,对布局使用绝对定位通常不是一个好主意。了解如何使用 float ,并摆脱 TABLE。

关于css - 修复网页中的水平滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7814262/

相关文章:

html - 将滚动框向下移动到文本框区域?

css - IE7 文本被下推

block - 如何使文本输入框占据父 block 内的所有剩余宽度?

javascript - 切换到备用样式表时如何防止出现主样式表?

jquery - 无法读取未定义的属性 'top'

Android:ViewPager 内的 Vertical ScrollView - 无法滚动

html - 固定 div 下的可滚动主体

html - 一键二动(换图)

jquery - 更改文本 jquery 的颜色(一次只有一个 div)

javascript - 子节点不会走出父div