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 3 of 3
  1. #1
    New Coder
    Join Date
    Nov 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Positioning w/ CSS

    I need to put things in 3 columns on a page, trying w/o tables, and for some reason, it always treats it like there's a <br> after each element.
    Code:
    .left {position: relative; left: 200px; }
    .right {position: relative; left: 800px; }
    
    .centeredImage
    
       {
    
       background-color: rgb(57,57,57);
    
       text-align:center;
    
       margin-top:0px;
    
       margin-bottom:0px;
    
       padding:0px;
    
       }
    That's the CSS, and whenever you use it, the lines get spread out vertically. What'd I do wrong?

  • #2
    Regular Coder
    Join Date
    Dec 2005
    Location
    Ohio
    Posts
    286
    Thanks
    7
    Thanked 9 Times in 9 Posts
    This should work. You needed to float the columns. There are lots of sources available, like here.

    Code:
    .left {
    position: relative; 
    float: left;
    width: 200px; 
    }
    
    .right {
    position: relative; 
    float: left;
    width: 800px; 
    }
    
    .centeredImage {
    float: left;
    background-color: rgb(57,57,57);
    text-align: center;
    margin-top: 0px;
    margin-bottom: 0px;
    padding: 0px;
    }

  • #3
    New Coder
    Join Date
    Nov 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, thanks. I'm only a fledgling CSS'er and hadn't seen that function yet. Thanks.


  •  

    Posting Permissions

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