Box to the right...

Discussion in 'CSS' started by StormForum, Jan 14, 2008.

  1. #1
    Okay, I have tried everything including setting the nav boxes to float: left but I'd have to make the div box I want to go to the right go to the complete right-hand side, when I make that float: right. Here is a snippet of the CSS code:

    div#nav {
    margin: 12px 0 0 9px;
    }
    
    div#nav li {
    margin: 4px;
    }
    
    div#nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    }
    
    div#nav li a {
    width: 120px;
    padding: 4px;
    background: #80cf8b;
    border: 3px solid #70a978;
    display: block;
    color: white;
    font-family: verdana, arial, sans-serif;
    font-size: 10pt;
    text-decoration: none;
    }
    
    div#nav li a:hover {
    background: #78c683;
    }
    
    div#content {
    margin-left: 10px;
    width: 70%;
    height: 300px;
    background: #80cf8b;
    border: 3px solid #70a978;
    }
    HTML:
    at the bottom is an attachment where there is a screenshot of the complete template. Basically I want the div box (the big content box) to the right-hand side exactly perfect to the div nav box's - if all makes sense.

    Hope someone can help.
     

    Attached Files:

    StormForum, Jan 14, 2008 IP
  2. donross

    donross Active Member

    Messages:
    90
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    98
    #2
    can you provide the html code??
     
    donross, Jan 14, 2008 IP
  3. StormForum

    StormForum Well-Known Member

    Messages:
    206
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #3
    Lol. Not sure if you need the HTML code at all ;). Anyone able to help at all, still got the same problem. And to you donross, you don't need the HTML code to fix the problem ;).
     
    StormForum, Jan 14, 2008 IP
  4. EIx

    EIx Peon

    Messages:
    170
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    the only answer when without HTML code : add "float :right"
     
    EIx, Jan 14, 2008 IP
  5. ChaosFoo

    ChaosFoo Peon

    Messages:
    232
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I'm not so sure why you think donross's request is so funny. If you have a coding question, providing the code is vital to getting an answer to your question.

    When working with floats, the order in which you apply the styles in the HTML is important. The only way to see what this order is, is by looking at the HTML code itself. Sure you posted the CSS, but if we don't know the order in which these styles are applied, and how they are nested in each other, you won't get a complete answer.

    How about you send the HTML code, or better yet, a link to this page?

    And no, this request is not a joke, and is not intended to be LOLed and ;) ed.
     
    ChaosFoo, Jan 15, 2008 IP
  6. manishk

    manishk Peon

    Messages:
    63
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I think the reason why StormForum is not able to fix the problem is because he is probably not even looking at his own HTML code. Now this is LOL stuff.
     
    manishk, Jan 15, 2008 IP
  7. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I still don't get what you want. In the template image, the big content box ISN'T to the right.

    Wait, you mean the image is what you have now? You want the nav box and the content box side by side??

    If that's the case, what I would do is in the HTML, have the nav come first, then the content box. Set no width on the content box. Float the nav left. In everyone except possibly IE cause it's stupid, the content will ride up alongside the nave box, and its width will be determined by how much room is left on the page. The nav box will have to have a set width. The content box will then need a left margin a little bit bigger than the width of the nav box to keep it from sliding under (not beneath) the nav box.

    One issue with this method is if there's stuff floated left inside the big content box, and then you want to clear it, it'll clear the nav box too (meaning all content after the clear will drop down til after the bottom of the nav box). The solution to this is to either float the big container (which means you'll have to fix some IE bugs) or better yet float something else around whatever stuff you may need to float inside the big container.

    I've done this in a few pages and generally it works (IE bugs aside, which have been dealt with).
     
    Stomme poes, Jan 15, 2008 IP