固定在背景上的元素

时间:2016-05-11 10:24:48

标签: html css

我试图制作一个从上面的另一个div元素后面出现的页脚。

An example is the Pitchfork website with the footer on the bottom.

我尝试在CSS中执行此操作:

#footer {
    overflow: hidden;
}
#footer .text {
    position: fixed;
}

或者我可以修复它并通过设置网站的总高度将其移动到页面底部。但这只是为了复杂化。

有关如何执行此操作的任何想法或简单教程?

2 个答案:

答案 0 :(得分:0)

试试这个:

#footer {
   position:fixed;
   left:0px;
   bottom:0px;
   height:30px;
   width:100%;
   background:#999;
}

/* IE 6 */
* html #footer {
   position:absolute;
   top:expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px');
}

答案 1 :(得分:0)

将此CSS分配给页脚:

$e{ q://QID1/ChoiceTextEntryValue * 100 }

这会将其固定在左下角并将其置于其他元素(z-index -1)

之后

此外,您必须将尽可能多的footer { position: fixed; bottom: 0; left: 0; width: 100%; z-index: -1; height: 150px; /* vaue as needed */ } 添加到文档流中的最后一个元素作为页脚的高度,以便内容可以在页脚上方滚动,在我的示例中为150px。

相关问题