February 26, 200818 yr Hi, I am currently trying to get something working on my site. At the moment, my code is as shows: <div class="maintop"> <div class="lefttop"><h1><?php echo $config['sitename']; ?></h1><h2><?php echo $config['tagline']; ?></h2></div> <div align="righttop"><h1>Login Form Here</h1></div> </div> Defined in my css, is as follows: .lefttop{ float:left; } .righttop{ float:right; } .maintop{ display:inline; } Both layers (defined "left" and "right" sit on below the other), is there something I'm missing?!
February 26, 200818 yr close the other div, you only 3 closing div tags. Also float the right one left and itl be to the right hand side of the left if thats any good...
February 26, 200818 yr You need to specify some widths as well - .lefttop+.righttop must be equal to or less than the width of .maintop
February 26, 200818 yr Yep, you need some widths. If you don't specify any, the browser will assume you mean 100%. That's why the divs are stacking on top of each other.
February 26, 200818 yr Does the left one actually need a float? Not necessarily I suppose - it might seem a bit "belt and braces" but float and width will ensure the parent container's height adjusts to the content inside it.
Create an account or sign in to comment