PDA

View Full Version : Fixed vs Relative - Container Length



mikacruz
Oct 12th, 2008, 07:48 PM
Hello Everyone,
I am a stuck by my limited knowledge of css, again :-(
I want to know how I can remedy to the fixed length of the container of that page. (http://www.sacred-egypt.com/test.html),
so I can have a length that is relative to the content (like in a table) rather than it being fixed like you can see for descriptive purpose on the page.
If anyone has a little suggestion for that, MUCH appreciated :-)
Here is the messy css link (http://www.sacred-egypt.com/stylehome.css)

Hope everyone is surfing over the current economic turmoil

abduraooft
Oct 12th, 2008, 08:01 PM
Try


html,body{
height:100%;
}
#container {/*stylehome.css (line 31)*/
background:#999933 url(images/img3.gif) repeat scroll 0 0;
min-height:100%;
margin:0 auto;
text-align:left;
width:840px;
}
* html #container{
height:100%; /*for IE*/
}

mikacruz
Oct 12th, 2008, 08:50 PM
thx for ur time Abdu ;-)
Its not working right. See Result (http://www.sacred-egypt.com/test.html) strange that the footer gets into container now when it remains defined outside of it in the html code....

abduraooft
Oct 13th, 2008, 08:50 AM
html #container {stylehome.css (line 41)
height:100%;
}
should be

* html #container {stylehome.css (line 41)
height:100%;
}

mikacruz
Oct 13th, 2008, 10:53 AM
I hope one day I can understand the logic of your help and I stop seeing you as a magician :-) Thanks again!!!

abduraooft
Oct 13th, 2008, 11:22 AM
lol, see http://bonrouge.com/2c-hf-fixed.php

[...] #wrap div is set to min-height:100% so that the page is, well, at least 100% high. The other bit after that is for IE, which is a bit stupid. IE doesn't understand 'min-height', but it treats 'height' in the same way as a good browser would treat 'min-height' so we're OK. When you tell the browser 'height:100%' though, it needs to know 100% of what? To make it clear, html and body are both set to 100% too.
So we are applying a height:100%; targeting IE only, via the *-selector hack.

PS: I don't call IE as a stupid, rather I respect it for its ability to recognise such hacks :p