Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stick text to the bottom of the page?

Tags:

html

css

I would like to put a line "All Rights Reserved..." at the bottom of the page. I tried to use absolute positioning, but this does not work as expected when the window resized to smaller height.

How can I achieve this simple goal ?

like image 601
Misha Moroshko Avatar asked May 11 '10 11:05

Misha Moroshko


People also ask

How do you make an element stick to the bottom of a page?

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.

How do you put a text in the very bottom of the page HTML?

The trick is in <br> where you break new line. So, when page is small you'll see footer at bottom of page, as you want.

How do I keep text at the bottom of a div?

You can also use css properties like: vertical-align:bottom; and float:right; .

How do I move text from top to bottom in HTML?

The <marquee> tag in HTML is used to create scrolling text or image in a webpages. It scrolls either from horizontally left to right or right to left, or vertically top to bottom or bottom to top.


2 Answers

You might want to put the absolutely aligned div in a relatively aligned container - this way it will still be contained into the container rather than the browser window.

<div style="position: relative;background-color: blue; width: 600px; height: 800px;">    

    <div style="position: absolute; bottom: 5px; background-color: green">
    TEST (C) 2010
    </div>
</div>
like image 135
Konerak Avatar answered Oct 22 '22 05:10

Konerak


Try:

.bottom {
    position: fixed;
    bottom: 0;
}
like image 28
Sergey Ilinsky Avatar answered Oct 22 '22 07:10

Sergey Ilinsky