WeLoveCSS Logo
Home Profile Members Search Rules Help New Posts



WeLoveCSS > WEB DESIGN > CSS > Gap between sidebar and footer

Reply
  Thread Tools Display Modes
Old 5th July 12, 06:27 PM   #1
neone
WLC Member
 
Join Date: Jun 2012
Posts: 11
Default Gap between sidebar and footer

Hello, I am creating my first own theme for wordpress.
So my problem is that I don't know how to remove the gap between sidebar and footer. My sidebar uses relative postioning with negative top value. What I need to do to remove that empty space? I noticed that the gap has same height as my negative top value, which is -55px.

The gap disappears only when sidebar is smaller in height than content.

My site URL is http://pcfix.site40.net/neo/
neone is offline   Reply With Quote
Old 5th July 12, 11:09 PM   #2
chrishirst
Banned
 
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
Default Re: Gap between sidebar and footer

The "gap" is simply where you have not made an allowance for how position: relative; affects an element and the normal flow.

Last edited by chrishirst; 6th July 12 at 08:29 AM.
chrishirst is offline   Reply With Quote
Old 6th July 12, 07:27 AM   #3
neone
WLC Member
 
Join Date: Jun 2012
Posts: 11
Default Re: Gap between sidebar and footer

Ok, I'll try too understand later today. Thanks
neone is offline   Reply With Quote
Old 6th July 12, 11:07 AM   #4
neone
WLC Member
 
Join Date: Jun 2012
Posts: 11
Default Re: Gap between sidebar and footer

I made changes to footer, I added same position as sidebar: relative and top -55px. Everything looks good when i add more than two widgets, because then sidebar, which also has relative position is near footer (sibling elements).

The problem is when I add only one or two widgets, then content, which is static, becomes sibling of footer and footer then overlaps content. I can't add relative position to content because it will overlap menu. I want to make everything look correct no matter how many widgets I add. I don't what to write in this situation.

Now you can see how site looks with two widgets.
neone is offline   Reply With Quote
Old 6th July 12, 03:18 PM   #5
chrishirst
Banned
 
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
Default Re: Gap between sidebar and footer

You need to restore the normal flow AFTER the relative positional shift. This is done by giving the positioned element a negative bottom margin of the same dimensions of the top property, or giving the adjacent sibling of the shifted element a negative TOP margin.
chrishirst is offline   Reply With Quote
Old 7th July 12, 01:46 PM   #6
neone
WLC Member
 
Join Date: Jun 2012
Posts: 11
Default Re: Gap between sidebar and footer

Thank you very much. Now everything is clear. I understand that when element is positioned relative, static position doesn't change and we must correct that by adding negative margin to bottom, to move not only element, but also static (default) position. Am I correct?
neone is offline   Reply With Quote
Reply


Thread Tools
Display Modes
Linear Mode Linear Mode

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:27 AM.



Home | Advertise | Contact Us | Top
Home | Advertise | Contact Us | Top

Copyright© 2006 WeLoveCSS.com. All Rights Reserved.
Powered by vBulletin Version 3.8.4 Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.