我正在一个站点与粘脚。最近,我为导航添加了购物车预览功能。基本上mouseover打开一个div来显示购物车内的物品。其实没什么特别的高div打破粘脚footer
问题首先发生在项目列表变得很长时。包含项目的div以某种方式打破了粘滞的页脚。
为了证明我做过jsFiddle example的行为。
我的HTML看起来像这样:
<div id = "main">
<div id = "navigation">
navigation
<div id = "cart">
cart
<div id = "cartItems">
<p>item 1</p>
<p>item 2</p>
<p>item 3</p>
<p>...</p>
</div>
</div>
</div>
<div id = "content">content</div>
<div id = "footer">footer</div>
</div>
CSS:
* {
margin:0;
padding:0;
}
html, body {
height: 100%;
}
#main {
width: 900px;
min-height: 100%;
margin: 0 auto;
position: relative;
background-color: lightpink;
}
#navigation {
height: 50px;
position: relative;
background-color: orange;
}
#content {
padding-bottom: 50px;
}
#footer {
width: 900px;
height: 50px;
position: absolute;
bottom: 0;
background-color: yellowgreen;
}
#cart {
width: 100px;
position: absolute;
top: 0;
right: 0;
background-color: red;
}
#cartItems {
display: none;
}
我希望有人可以给我一个提示。我真的被困在这一个。
+1对于格式良好的问题 –
打破页脚意味着什么?正如我认为,当列表很长时,你会说列表会列入页脚。所以要解决这个问题,你可以将z-index添加到#cart。 [检查这个小提琴](http://jsfiddle.net/PMabQ/19/) – crazyrohila
看看滚动条,页脚应该在页面的底部,而不是窗口的底部。 –