【发布时间】:2017-05-09 18:56:29
【问题描述】:
我的问题:
我设计了单页。页眉、内容(部分和旁边)和页脚。
页脚和页眉是粘性的。
我希望内容贴在页尾和页脚上方。
请指导我。
【问题讨论】:
-
坦克。我稍后播种。这不是我的遮阳篷。我想要一个 div(内容)粘在页脚上。
标签: css sticky sticky-session
我的问题:
我设计了单页。页眉、内容(部分和旁边)和页脚。
页脚和页眉是粘性的。
我希望内容贴在页尾和页脚上方。
请指导我。
【问题讨论】:
标签: css sticky sticky-session
你是在暗示这样的事情吗?在这个例子中。无论屏幕尺寸如何,您的内容都将始终停留在页脚上,即使其中只有一行。
*{
box-sizing: border-box;
}
body, html{
height: 100%;
width: 100%;
margin: 0;
}
body{
display:flex;
flex-direction: column;
}
#container
{
margin: 0 auto;
width:90%;
background-color: white;
border: 2px solid black;
flex-shrink:0;
flex-grow:1;
display:flex;
}
.header,.footer
{
margin: 0 auto;
width:100%;
text-align: center;
height:1.5em;
background-color: white;
border: 1px solid black;
flex-shrink:0;
background-color:green;
color:white;
}
.col {
height:90%;
flex-shrink:0;
flex-grow:1;
margin:0 2% 0 2%;
}
<div class="header">
Header here
</div>
<div id="container">
<div class="col">
test column 1
<p>
Content
</p>
<p>
Content
</p>
<p>
Content
</p>
</div>
<div class="col">
test column 2
<p>
Content
</p>
<p>
Content
</p>
<p>
Content
</p>
</div>
</div>
<div class="footer">
Footer Here
</div>
【讨论】: