所以,首先在这里发帖,我一直在努力寻找这个问题的答案。
我有两个 div:
#splash {
width:100%;
min-width:1024px;
height:auto;
position:fixed;
top:80px;
z-index:-1;
}
#maincontentwrap {
width:100%;
min-width:1024px;
height:2000px;
z-index:100;
background:#838d82;
}
我想表达的想法是,我希望#maincontentwrap 直接定位在#splash 之下,但我希望#maincontentwrap 保持固定位置,而#splash 滚动它。我想问题出在我试图将某个东西直接放在另一个高度不同的东西下面。
如能深入了解此事,我们将不胜感激。两天的修修补补并没有太大结果。
提前致谢!
最佳答案
你应该使用 position: fixed
或 position: absolute
在你的#maincontentwrap
并根据 #splash
的高度调整边距和填充.
如果高度是在运行时确定的,你应该考虑使用JavaScript来计算和设置#maincontentwrap
的边距。 .
关于html - 将 DIV 直接定位在 100% 宽度自动高度固定位置 DIV 下,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21436871/