Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Oct 2008
    Posts
    185
    Thanks
    12
    Thanked 0 Times in 0 Posts

    RESOLVED Need Help Positioning Divs Next to Each Other...

    I need to position the first 2 divs ("logo" and "number" divs) next to each other. Help, please?

    http://petsonthemovenyc.com/

  • #2
    New Coder
    Join Date
    May 2009
    Posts
    47
    Thanks
    3
    Thanked 0 Times in 0 Posts
    display:inline;
    for the second div

  • #3
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,749
    Thanks
    22
    Thanked 1,838 Times in 1,822 Posts
    Hello Jihanemo,
    While display:inline; can sometimes stop an ie6 float bug, it's not what's needed here.

    To make it easier to see what's going on, give your divs different background colors, like this:
    Code:
    div.logo {
    
    margin: 60px 0 10px 0;
    background: #00f;
    
    }
    
    
    div.number {
    background: #f00;
    color: #666666;
    text-align: right;
    font-size: 11px;
    font-family: Verdana,Arial,Helvetica,sans-serif;
    
    }
    To place things side by side we float them. To float something, you need to give it a width.
    Try this:
    Code:
    div.logo {
    width: 400px; /*required width*/
    float: left; /*float makes it so something can go beside it*/
    margin: 0 0 10px 0;
    background: #00f;
    
    }
    
    
    div.number {
    margin: 0 0 0 400px; /*.number is margined over the width of .logo*/
    background: #f00;
    color: #666666;
    text-align: right;
    font-size: 11px;
    font-family: Verdana,Arial,Helvetica,sans-serif;
    
    }
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #4
    Regular Coder
    Join Date
    Oct 2008
    Posts
    185
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Thank you!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •