March 30, 201115 yr Hi, I'd appreciated everybody's help. I have used relative and negative positioning to place a footer image (#containerFooter) underneath the main content of my site. For some reason, which I can't work out, it is adding a large space underneath the footer image. Here's the page in question: happypawsredditch.co.uk/index1.html Here's my CSS: body { background-image:url(../images/body-bg.gif); background-repeat:repeat-x; background-color:#A0DB53; margin:0; } #containerMain { width:980px; margin:0 auto 0 auto; } #containerHeader { width:980px; height:188px; float:left; background-image:url(../images/header-bg-trans.png); background-repeat:no-repeat; } #logo { width:314px; height:173px; margin:0 0 0 29px; float:left; } #contact { font-family:Verdana, Geneva, sans-serif; font-size:18px; width:306px; text-align:center; float:right; margin:49px 5px 0 0; line-height:25px; } #contact a:link, #contact a:visited { color:#443735; font-size:16px; text-decoration:none; } #contact a:hover { color:#ED2274; font-size:16px; text-decoration:none; } .pink-text { color:#ED2274; } #containerMenu { width:162px; height:249px; background-image:url(../images/menu-bg-trans.png); background-repeat:no-repeat; float:left; margin:0 0 0 1px; } #containerContent { width:793px; float:right; margin:0 5px 0 0; } #contentTop { background-image:url(../images/content-top-trans.png); background-repeat:no-repeat; width:793px; height:24px; float:left; } #contentBody { background-image:url(../images/content-bg-trans.png); background-repeat:repeat-y; width:793px; float:left; min-height:366px; } #contentBase { background-image:url(../images/content-base-trans.png); background-repeat:no-repeat; width:793px; float:left; height:254px; } .clear {clear:both;} #containerFooter { margin: 0 auto 0 auto; height:470px; background-image:url(../images/footer-bg.jpg); background-repeat:no-repeat; position:relative; top:-430px; z-index:-1; } Thanks in advance!
March 30, 201115 yr Using relative positioning and then moving it will always leave an empty space where the div 'would have been'. You could try nesting your div containing the image within your 'containercontent' div with your z-index still set to -1? Dave
March 30, 201115 yr Author Using relative positioning and then moving it will always leave an empty space where the div 'would have been'. You could try nesting your div containing the image within your 'containercontent' div with your z-index still set to -1? Dave Thanks Dave, but the #containercontent div is a different width, so would that work?
March 30, 201115 yr Thanks Dave, but the #containercontent div is a different width, so would that work? You should be able to use relative positioning (relative to the #containercontent div) or use padding to position it in the correct position. Might need to make the #containercontent div wider to accomodate the image. It's difficult to suggest anything without playing around with it myself, I would be happy to try if you want to PM me your files? Dave
March 30, 201115 yr Author I've changed the CSS slightly and it's working well in all browsers apart from IE. Any ideas how I can get this working in IE too? happypawsredditch.co.uk/index1.html #containerFooter { margin: -430px auto 0 auto; height:470px; background-image:url(../images/footer-bg.jpg); background-repeat:no-repeat; z-index:-1; }
March 30, 201115 yr Author Problem solved. Removed the clear class, and applied this... #containerFooter { position:relative; float:left; height:470px; background-image:url(../images/footer-bg.jpg); width:100%; margin-top:-430px; z-index:-1; } Thanks for your help.
March 30, 201115 yr Problem solved. Removed the clear class, and applied this... #containerFooter { position:relative; float:left; height:470px; background-image:url(../images/footer-bg.jpg); width:100%; margin-top:-430px; z-index:-1; } Thanks for your help. Ahh, negative margin-top, good thinking! Glad you've sorted it, it looks good!
Create an account or sign in to comment