...

View Full Version : Maybe simple div/css question.



mack10
08-09-2010, 12:46 AM
And I have a link for you guys to look at: http://tamashiiltd.com. Now, for the explanation.

I have two divs, one "container" and one "footer"..I have them aligned as I would like with container centered in the browser and footer spanning the page, but what I want is for the footer to be at the foot of the page rather than how it is right now. As it stands now, my container div scales to 100% in the vertical and pushes my footer below the browsers height therefore forcing the user to scroll even when there isn't any content in the "container" of the page. Anyone have a css solution to this? thanks.

PitbullMean
08-09-2010, 01:09 AM
Try using a sticky footer bud.

http://www.cssstickyfooter.com/

mack10
08-09-2010, 01:37 AM
Wow its like that code was written just for me :P. Thanks for that - now I actually have another question. see link: http://tamashiiltd.com/testingdivs.htm.

This time I have a "body" div nested inside the "container" div - as you can see, when I scale the "body" div past the "container" div's height, it just overlaps its edge and doesn't automatically adjust the container div, what I would like is for the "container" to scale automatically when I manually scale the body div - (css height: auto - doesn't work). I scaled the container div to 400px and the body div to 500px for illustrative purposes. Any fix or workaround to this? should I not be nesting divs inside divs? what's a good alternative? thanks.

bazz
08-09-2010, 01:43 AM
useful link PitBullmean but I disgree with one point in it.

just about the CSS paragraph he wrote:


If you wanted to place any elements outside of either the wrap or the footer then you would need to use absolute positioning else it messes up the 100% height calculations.


If you have more elements to add, put them all inside a container and keep the footer in its own container beneath the main one. if themain one shriknks from page to page as determined by more or less content, the footer will always ride up. if the content of the main container is very short, you may see the footer too 'high' in which case, you may need to position it absolutely to the bottom of your viewport.

My point was simply that it seemed to me the writer of that article was suggesting a jump to absolute positioning before it is needed. that siad, there are several much more proficient CSS'ers here than me so I amy stand corrected. Just don't rush into absolute positioning. It can wreak havoc with x-browser support.

bazz

PitbullMean
08-09-2010, 01:46 AM
@bazz, that code has been tested across the board on all browsers so he wont have to worry about havoc.

PitbullMean
08-09-2010, 02:01 AM
@mack10, Maybe this link will help you with your problem http://www.netmechanic.com/news/vol7/css_no8.htm

mack10
08-09-2010, 02:31 AM
@mack10, Maybe this link will help you with your problem http://www.netmechanic.com/news/vol7/css_no8.htm

That is a helpful link thanks you once again. However, I don't think it'll solve my problem, I guess I'll just manually scale the container div in the vertical direction to what I need although that doesn't seem ideal.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum