Forum Moderators: not2easy

Message Too Old, No Replies

Getting footer to stick in ie

         

atad6

3:02 am on Jul 28, 2005 (gmt 0)

10+ Year Member



Hi, I've been fighting and fighting with this and I can't seem to get it to work. I have a fixed width page and I want a div element (footer) to stick at the bottom of the page. I used this tutorial here:

[solardreamstudios.com...]

and it works perfectly with firefox (even when centered) and ie. The problem is, when I try to center the layout ie doesn't seem to work. It shifts the whole layout over to the right and horizontally scrolls. I cannot figure this out. So I went back and started from scratch trying to just get ie to be able to have a footer that sticks to the bottom of a centered fixed width layout and I can't seem to do this.

Hopefully I didn't confuse anyone by that above. Just to make it simple all I'm asking for is code that would allow a footer element to stick to the bottom of a fixed width centered page correctly in ie. It doesn't even have to work in firefox as i allready can do that. Any suggestions would help tremendously.

Thanks!

faltered

12:39 pm on Jul 28, 2005 (gmt 0)

10+ Year Member



atad: Could you post some code for us to see? It would be easier for us to figure out exactly what you're doing and what could possibly be going wrong.

atad6

12:30 am on Jul 29, 2005 (gmt 0)

10+ Year Member



<html>
<head>
<style>

body
{
margin: 0;
padding: 0;
text-align: center;
height: 100%;
}

#footer
{
background-color: #cccccc;
width: 785px;
position: absolute;
height: 38px;
bottom: 0;
}

</style>
</head>
<body>

<div id="footer">Footer</div>

</body>
</html>

Here's the code in the most basic form. This is just for ie.

Hope that helps!

atad6

8:53 pm on Jul 29, 2005 (gmt 0)

10+ Year Member



Does anyone have any solutions or ideas? I'm pretty stuck.

tedster

9:08 pm on Jul 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



when I try to center the layout ie doesn't seem to work.

What approach are you taking to centering the layout?

atad6

12:03 am on Jul 30, 2005 (gmt 0)

10+ Year Member



For ie i'm using the text-align: center for the body. If you try the code in ie you will see what I mean.

tedster

1:44 am on Jul 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



text-align is for aligning text, nor for aligning block level elements in the layout (although IE alone does treat it that way).

The first thing to do when tackling rendering issues is make sure your mark-up is valid.

W3C Validator - HTML [validator.w3.org]
W3C Validator - CSS [jigsaw.w3.org]

Then, as to the centering issue, there are many previous threads here about valid ways to center the page, not just align the text. Fo example: [webmasterworld.com...]