PDA

Click to See Complete Forum and Search --> : Aligning text to the bottom of the page



Dan Abz
03-09-2007, 06:27 AM
Hi,

Is there any other way to get a block of text to align to the bottom of the page?

Just now Iíve put it in a div then made the positioning absolute and to 550px.

But when a user with a smaller screen size goes on they will need to scroll to see it as it doesnít fit on their screen and we do not want the page to scroll at all.

Any help would be great.

Cheers

ihoss.com
03-10-2007, 06:44 PM
position: absolute;
bottom: 0px;

aversion
03-10-2007, 07:07 PM
If the page scrolls that won't keep the block at the bottom of the page in most browsers.

In modern browsers position: fixed will do it but IE stumbles here, though I think IE7 understands it.

I know this is a question much asked in web dev forums but I've never seen a satisfactory answer. If you want to support IE you could use javascript to keep the block in the desired position when the page is scrolled or there are CSS hacks that work somewhat. There's an example of a javascript way to do it here (http://dean.edwards.name/IE7/) or a CSS way here (http://www.456bereastreet.com/lab/cssframes/).

Dan Abz
03-12-2007, 04:55 AM
Thanks for both the answers.

I was able to change my div to what ihoos.com said.

Thanks again

aversion
03-12-2007, 03:45 PM
And your div stays in position even when the page scrolls in IE, Safari and Moz browsers? I'd like to see a solution where position:absolute does that, it would help a lot of people.

ihoss.com
03-12-2007, 07:30 PM
aversion, he didn't want it to stay at the bottom of the browser, only bottom of the page :)

how does position: fixed work? If you say bottom: 0px; will it stay at the bottom even if you resize the window?

I'll have to look into this :p

aversion
03-12-2007, 07:47 PM
That's true.

Position: fixed will make something stick, so it won't scroll with the page. You can 'fix' it anywhere and it won't move. Now IE7 supports it I assume we'll have a gazillion pages with 'stuck' content on them for no reason in a year or so!

ihoss.com
03-12-2007, 07:52 PM
stop the whining; the web is all about doing stuff for no reason! :p