Layout Help Please

Discussion in 'CSS' started by wd_2k6, Apr 17, 2008.

  1. #1
    Hi i can't think straight at the moment, how would i go about the following:

    Fixed width 300px div on the right, with a 100% div to the left of it..
    and i want the 300px div opened first on the source code!!

    EDIT: I think i've done it by floating both to the right, and adding a margin-right to the 100% div of -300px!!
     
    wd_2k6, Apr 17, 2008 IP
  2. jordanthegreat

    jordanthegreat Active Member

    Messages:
    390
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #2
    I may be wrong but I think floating both div's will cause a problem. Just float the 300px and dont float the 100%. so its like this:

    HTML:
    
    <div id="right"></div>
    <div id="left"></div>
    
    Code (markup):
    CSS:
    
    #right {
    	float: right;
    	padding: 0;
    	margin: 0;
    	border: 2px solid #000;
    	width: 300px;
    	height: 200px;
    }
    
    #left {
    	padding:0;
    	margin: 0 300px 0 0;
    	border: 2px solid #000;
    	height: 200px;
    }
    
    Code (markup):
    Ignore border and height, those are just there so I could see my results in testing.
     
    jordanthegreat, Apr 17, 2008 IP
    wd_2k6 likes this.
  3. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you very much for the fast and effective reply this is just what i needed!! There is just one problem I have a border underneath my heading for the left div, and it carries all the way across and can be seen underneath the right column?
    For e.g

    <div id="right">right right right right right right right right right right right right right right right right right right right right right </div>
    <div id="left"><h2>dotted line test</h2></div>

    #left h2 { border-bottom: 5px dotted #000 ; }
     
    wd_2k6, Apr 17, 2008 IP
  4. jordanthegreat

    jordanthegreat Active Member

    Messages:
    390
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #4
    What browser are you using? I'm not getting that problem in FF2 or IE7.

    I am running my test with just the bar minimum code we have mentioned in this thread, so maybe if you have some other code already in place, something there is messing with it. Post your full css and html if you can.
     
    jordanthegreat, Apr 17, 2008 IP
  5. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Woops my own fault I had margin-right: 0 300px 0 0; instead of just margin!! Thanks again.
     
    wd_2k6, Apr 17, 2008 IP
  6. jordanthegreat

    jordanthegreat Active Member

    Messages:
    390
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #6
    lol. no prob man :)
     
    jordanthegreat, Apr 17, 2008 IP