Hayi
Hayi

Reputation: 6236

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

Upvotes: 1

Views: 70

Answers (2)

WebDevDaniel
WebDevDaniel

Reputation: 74

Try adding this css to your id or class:

div {   
position: absolute; 
bottom: 0; 
}

Upvotes: 1

Weafs.py
Weafs.py

Reputation: 22992

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>

Upvotes: 2

Related Questions