Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put a div on bottom of the screen, not page

I am trying to put a gray bar on the bottom of the screen of my webpage, regardless of the resolution. However, when I try, it seems to just go up or down when I go in a different resolution. Is there any way to fix this?

Also, the bar is made out of CSS using the div id tag.

/* HTML*/ <div id="info">Scroll for info</div>  /* CSS */ <style> #info {      height: 40px;      position: relative;      margin-top: 25%;      background-color: #393838;      opacity:  } </style> 

EDIT: I want it to be on the bottom of the screen, but then when I scroll down it goes up towards the top of my screen.

like image 763
Nikolas Avatar asked Nov 28 '13 23:11

Nikolas


People also ask

How do I place a div at the bottom without absolute?

Without using position: absolute , you'd have to vertically align it. You can use vertical-align: bottom which, according to the docs: The vertical-align CSS property specifies the vertical alignment of an inline or table-cell box.


1 Answers

If you want it on the bottom and always at the bottom, you have to use position: fixed. You could try this:

#info {      height: 40px;      position: fixed;      bottom:0%;     width:100%;      background-color: #393838;      opacity: 1; } 

http://jsfiddle.net/rX4nd/1/

like image 121
putvande Avatar answered Sep 28 '22 20:09

putvande