Forum Moderators: not2easy

Message Too Old, No Replies

fix div auto height

         

Why_not

8:04 pm on Nov 22, 2008 (gmt 0)

10+ Year Member



hi ! i have 3 div for index page .
<div id="1" align="center"><div style="float:left; width:20%;">&nbsp;</div><div id="2" style="float:left; width:60%;">&nbsp;</div><div id="3" style="float:right; width:20%;">&nbsp;</div></div>
1 = left with background
2 = middle with background
3 = right with background
Now how to write css when type in middle , all DIV ( left + right ) auto height and change to bottom !?
in table methods this worked nice but how to in DIV with css ? regards ( sorry for bad english )

swa66

1:33 am on Dec 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Basically CSS is not tables. You really need to start to think different, not just replace a table with a load of divs, or you'll get frustrated.

"auto" height is already on (that's the default), but it's not what you seek: inherit the height of a parent that's got no set height itself (that just doesn't exist in CSS). The closest CSS you have is "height: 100%;": it set the height to the direct parent that has a set height (but in most cases people asking for this want the parent to stretch to it's longest child and then it fails.

the trick to use in cases like this is to use the background of the parent and make fake columns in it (faux columns) also search for flexi-floats.