css - 内容不使用位置 :absolute 滚动

标签 css scroll position

在我工作的网站上,内容没有滚动。因此在 1024 x 768 显示器上看不到图像的顶部。我该如何纠正这个问题?

http://kenerly.com/test/index.html

最佳答案

一个解决方案是: 像这样将最小高度添加到您的 div#main 并将溢出设置为自动。同时将 position 设置为 relative。这样小屋的图像(header)将位于#main-Container 的底部:

#main{
    min-height: 768px;
    overflow: auto;
    position: relative;
}

为了避免难看的滚动条,永远不要使用overflow: scroll,总是使用overflow: auto。同样在这种情况下,设置

#header {
    position: absolute;
    bottom: 0;
    // The following values are not really necessary, 
    // as they are the default values or are calculated automatically 
    // to the same values, so feel free to remove them
    width: 100%; // automatically calculated by the #header's contents
    overflow: auto; // default value anyways
    height: 768px; // automatically calculated by the #header's contents
}

关于css - 内容不使用位置 :absolute 滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17952987/

相关文章:

javascript - Famo.us ScrollView 像聊天一样滚动

image - 如何使用 python 语言在 kivy 中定位图像?

html - 尝试制作一个带有不转到新页面的选项卡的网站。建议?

html - Twitter Bootstrap 导航菜单不会在小分辨率下展开

jquery - 悬停时水平滚动不顺畅

css - 子菜单中的垂直滚动不起作用

css - 页眉 Div 位置固定在页面顶部,但在加载时在其顶部显示一个 div

cocoa - 我将如何更改对象的 (x,y) 位置

javascript - 如何关闭我的弹出窗口并停留在引用页面上的同一位置?

css - 链接 PDF(带图标)的最佳方法是什么?