Please help with floating divs?

Discussion in 'CSS' started by mokimofiki, Feb 9, 2010.

  1. #1
    I am having trouble with floating divs. I am very tired and know i'm just forgetting something here is what I have.

    my CSS
    div#main {
    text-align: left;
    margin-top: 1px;
    padding: 10px;
    }
    
    #content {
      margin-right:  175px;
    }
    #rightnav {
      float: right;
      width: 150px;
    }
    Code (markup):
    and here is the code:
    <div id="main">
    <div id="content"><?php include('body.php');?></div>
    <div id="rightnav"><?php include('rightnav.php');?></div>
    </div>
    Code (markup):
    What is happening is the content is showing up top left and the rightnav is showing up bottom right. Anyone see what i'm doing wrong?

    Thank you in advance
     
    mokimofiki, Feb 9, 2010 IP
  2. daniar

    daniar Guest

    Messages:
    174
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #2
    Try this

    #content {
      margin-right:  175px;
      float: left;
    }
    #rightnav {
      float: left;
      width: 150px;
    }
    Code (markup):
     
    daniar, Feb 9, 2010 IP
  3. mokimofiki

    mokimofiki Well-Known Member

    Messages:
    444
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #3
    Thank you for your reply. I tried that and it just puts the content left aligned and the rightnav left aligned below it. any other thoughts?
     
    mokimofiki, Feb 9, 2010 IP
  4. daniar

    daniar Guest

    Messages:
    174
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #4
    perhaps the problem is in your <?php include('body.php');?> and <?php include('rightnav.php');?>
     
    daniar, Feb 9, 2010 IP
  5. mokimofiki

    mokimofiki Well-Known Member

    Messages:
    444
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #5
    those to files only have text in them for the time being so that I can test the 2 columns. There is no code in either of them. I'm at a loss
     
    mokimofiki, Feb 9, 2010 IP