Goldeneye Posted July 19, 2008 Share Posted July 19, 2008 I've got a DIV that holds two left-floated DIVs which has a height of zero. This has always kind of bothered me when holding floated DIVs inside a container DIV, so I tried fixing it with a clear: both; property on the .wrapmessage class but it didn't work. Yes I scoured Google for a solution and found a few that didn't seem to work. So does anyone know how to fix this problem (give the container DIV the height of the bigger (height-wise) DIV.)? I hope I made it clear enough.. A preemptive thanks, anyways. <html> <head> <title>FooBar</title> <style type="text/css"> div.wrapmessage {clear: both; border: 1px solid red;} div.messageinfo {float: left; width: 100px; border: 1px solid green;} div.messagebody {float: left; width: 200px; border: 1px solid blue;} </style> </head> <body> <div class="wrapmessage"> <div class="messageinfo">LEFT DIV - FOOBAR</div> <div class="messagebody">RIGHT DIV - FOOBAR</div> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/115534-solved-container-div-holding-floated-divs-fixing-the-height/ Share on other sites More sharing options...
haku Posted July 19, 2008 Share Posted July 19, 2008 I don't really understand most of what you were trying to say, but reading this: So does anyone know how to fix this problem (give the container DIV the height of the bigger (height-wise) DIV.)? I think you may want to give the containing div the following css attribute: overflow: auto; And if you have the height set to zero, get rid of that. Quote Link to comment https://forums.phpfreaks.com/topic/115534-solved-container-div-holding-floated-divs-fixing-the-height/#findComment-593945 Share on other sites More sharing options...
Goldeneye Posted July 19, 2008 Author Share Posted July 19, 2008 Ahh why thank you, I thought this would've been a job for the clear selector. I guess I'll need to read up on this a little more. And no, I use the height attribute sparingly haha. Quote Link to comment https://forums.phpfreaks.com/topic/115534-solved-container-div-holding-floated-divs-fixing-the-height/#findComment-593961 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.