I have a fixed-width DIV that I want to remain at the bottom of the browser's viewport.
Unfortunately, I haven't a clue where I would even begin to try to implement this.
Obviously the first thing to do is set position
to fixed
. But beyond that... no clue.
Set the position of div at the bottom of its container can be done using bottom, and position property. Set position value to absolute and bottom value to zero to placed a div at the bottom of container.
If you need to make a <div> element extend to the bottom and fill the page, try the following. Use viewport units and set the height and width of the <body> element to “100vh” and “100vw” respectively. Both the margin and padding of the <html> and <body> elements must be set to 0.
See at css-tricks:
Fixed Footer
CSS:
#footer { position:fixed; left:0px; bottom:0px; height:30px; width:100%; background:#999; } /* IE 6 */ * html #footer { position:absolute; top:expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px'); }
#mydiv{ position: fixed; bottom: 0px; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With