简体   繁体   English

Div位于屏幕底部

[英]Div in the bottom of the screen

How can i put a div in the bottom of the screen not the page ? 如何在屏幕底部放置div而不是页面?

But i don't want to use position:fixed because i want once i scroll down , the div go up like other elements. 但我不想使用position:fixed因为我希望一旦我向下滚动,div就会像其他元素一样上升。

like the div in this web site 喜欢这个网站的div

You could use the vh unit to do this. 您可以使用vh单元执行此操作。

 body, html { height: 1000px; margin: 0; } div { position: relative; width: 100px; height: 100px; background: tan; top: calc(100vh - 100px); } 
 <div></div> 

Try adding this css to your id or class: 尝试将此css添加到您的ID或类:

div {   
position: absolute; 
bottom: 0; 
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM