隐藏屏幕底部的div?

时间:2015-03-31 17:53:03

标签: html css css3

我有一个div:

<div id="hide-me">
   <p>some content</p>
</div>

如何使用CSS将其置于屏幕底部,我稍后计划从底部对其进行动画制作。)

4 个答案:

答案 0 :(得分:3)

#hide-me {
position: absolute;
bottom: 0;
margin-top: -30px;
}

答案 1 :(得分:2)

使用

margin-bottom:-999px;

对于相对定位的div

或绝对定位div使用

bottom:-999px;

答案 2 :(得分:2)

使用position:absolute

&#13;
&#13;
#hide-me {
  position: absolute;
  bottom: -99999px;
}
&#13;
<div id="hide-me">
  <p>some content</p>
</div>
&#13;
&#13;
&#13;

答案 3 :(得分:1)

您可以使用绝对定位:

#hide-me
{
    position: absolute;
    bottom: 0;
    margin-top: -50px;
}

但请记住设置html&amp;的高度。身体元素为100%!

html, body
{
    height: 100%;
}
相关问题