Results 1 to 6 of 6

Thread: Divs and Fire Fox does not work

  1. #1
    Join Date
    Jul 2006
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Divs and Fire Fox does not work

    How to make the following three divs stack one on top of each other and the fourth div float to the left of all three divs. M$ works .... FF does not...

    HTML:

    <div id="container">

    <div id="one"> <p>some text</p></div>
    <div id="two"> <p>some text</p></div>
    <div id="three"> <p>some text</p></div>
    <div id="fourth"> <p>some text</p></div>

    </div>


    CSS:

    #one {float:left; clear:left;}
    #two {float:left; clear:left;}
    #three {float:left; clear:left;}
    #four {float:left;}

    With FF, the fourth div floats left of the third div

    With IE, the fourth div floats left of the first div ....this is what I want.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You must specify a width for floated elements.
    Code:
    #container div {
      width: 100%;
      float: left;
      clear: left;
    }
    
    #four {
      clear: none;
    }
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jul 2006
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Still same ... here's the actual css code.

    FF floats the fourth div but only up to the 3rd div. Not sure how to get FF to float the fourth div next to the first div.

    If you need the html let me know.


    Code:
    #container {
     width: 46em;
     text-align:left;
     margin: 0em auto;
     padding: 0em;
     background-color: #e8e8e8;
     color: #000;
    }
    
    
    #lcontent1 {
     float: left;
     clear: left;
     width: 10em;
     margin: 0em;
     padding: 0emm;
    }
    
    #lcontent2 {
     float: left;
     clear: left;
     width: 10em;
     margin: 0em;
     padding: 0em;
    }
    
    #lcontent3 {
     float: left;
     clear: left;
     width: 10em;
     margin: 0em;
     padding: 0em;
    }
    
    #rcontent {
     float: left; 
     width: 33em;
     padding: 0em; 
     margin: 0em;
     background-color: #e8e8e8;
     color: #000;
     border-left: .06em solid #ccc;
     border-bottom: .06em solid #ccc;
    }
    Last edited by Girard Ibanez; 09-04-2006 at 10:28 PM.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    FF floats the fourth div but only up to the 3rd div. Not sure how to get FF to float the fourth div next to the first div.
    It will do that. If you want a layout like the one you are describing, take the clear: left; off the second div, put it on the fourth div, and put the content from the fourth div into the second div.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Girard Ibanez
    How to make the following three divs stack one on top of each other and the fourth div float to the left of all three divs.
    If you need to maintain content order, then use absolute positioning. That is, if the content of the fourth element should logically occur after the other three (think about what happens with CSS disabled or how search engines will see the source), add appropriate left margins to the first three elements, absolutely-position the fourth, and relatively-position the container.

    If the content is relatively independent (like a navigation menu), put it as the first element, float it, and allow the others to flow normally (no floats, no positioning). You can, if you like, add left margins here as well if you want a consistent left edge for the non-floated content.

    Mike

  6. #6
    Join Date
    Jul 2006
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks again for the advice.

    Will do...

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
  •