SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Feb 2005
    Posts
    311
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS - Used to tables, any help?

    Having a little problem with css.
    When having two divs how do i tell
    1 to take 40px of space
    2 the other to take the rest

    Thanks,
    THierry

  2. #2
    Word Painter silver trophy Shyflower's Avatar
    Join Date
    Oct 2003
    Location
    Winona, MN USA
    Posts
    10,053
    Mentioned
    142 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by lajkonik86
    Having a little problem with css.
    When having two divs how do i tell
    1 to take 40px of space
    2 the other to take the rest

    Thanks,
    THierry
    You might get more help if you pm'd a mod and asked them to move this to the css forum.
    Linda Jenkinson
    "Say what you mean. Mean what you say. But don't say it mean." ~Unknown

  3. #3
    Non-Member Egor's Avatar
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    7,305
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Hi Thierry, it depends on your situation and how everything else is positioned. Can you show some code, or give a link to what you have so far?

    Here's two divs in a container which can be of any width, but I'll make it 500px for the example:

    css:
    Code:
    #wrap {
    width: 500px;
    background: pink;
    }
    
    #left {
    float: left;
    width: 40px;
    background: yellow;
    }
    
    #right {
    margin-left: 40px;
    background: green;
    }
    
    #clear {
    height: 1%;
    overflow: hidden;
    }
    html:

    Code:
    <div id="wrap">
    
    <div id="left">40px wide</div>
    <div id="right">This is the rest</div>
    
    <div id="clear"></div>
    </div>

  4. #4
    SitePoint Addict
    Join Date
    Feb 2005
    Posts
    311
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok reduced the code a bit,
    Copy this in your editing program and you'll see the problem
    PHP Code:
    <style>
    div#left {
    floatleft;
    margin0 0 0 5;
    padding3px 0 0 3px;
    width100px;
    height400px;
    background-colorred;
    }
    div#content {
    floatleft;
    margin0 10 0 10;
    padding3px 0 0 3px;
    width100%;
    height400px;
    background-colorwhite;
    }
    div#container {
    width100%;
    height500px;
    background-colorgray;
    }
    </
    style>
    <
    div id="container">
          <
    div id="left">
            
    left
          
    </div>
          <
    div id="content">
            
    content
          
    </div>
        </
    div

  5. #5
    SitePoint Addict
    Join Date
    Feb 2005
    Posts
    311
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok sorry for that question
    guess the float was messing things up


Bookmarks

Posting Permissions

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