简体   繁体   中英

Div in the bottom of the screen

How can i put a div in the bottom of the screen not the page ?

But i don't want to use position:fixed because i want once i scroll down , the div go up like other elements.

like the div in this web site

You could use the vh unit to do this.

 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:

div {   
position: absolute; 
bottom: 0; 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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