I have the following css
.container {margin-left:auto; margin-right:auto; width:1020px;}
.body {float:left; width:1020px;}
.leftcont {float:left; width:206px;}
.left {float:left; width:205px;border-right-width:thin;border-right-style:solid; padding-right:5px;}
.right {float:left;width:813px; padding: 20px;}
The html:
<div class="container">
<?php
include("navigation/footNav.php");
?>
<div class="body">
<div class="leftcont">
<?php
if($session->logged_in){
include("navigation/sideLogIn.php");
}
else
{
include("navigation/sideLogOut.php");
}
?&g开发者_如何学JAVAt;
<div class="left">
<div class="bar">
<h1 class="title">Page Menu</h1>
<div class="arrow"></div>
<a href="/settings.php" class="list">My Settings</a>
<br />
<div class="arrow"></div>
<a href="/process.php" class="list">Logout</a>
<br />
</div>
</div>
</div>
<div class="right">
THis text
</div>
</div>
<?php
include("navigation/footer.php");
?>
leftcont and right are supposed to line up side by side. But for some reason, the right div is dropping below the left one?
Any ideas?
Thanks
Your .body
width is 1020px
, which will contain the .leftcont
's 206px
and the .right
813px
, but it won't hold it with that padding: 20px
on there, which makes the width effectively 843
.
You either need to reduce the padding or width on .right
, or expand the with on .body
.
206 + 813 + 20 + 20 = 1059
You need to decrease the width of leftCont
or right
, or decrease the padding of right
.
精彩评论