Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorJosh
    • CommentTimeJun 29th 2006
     permalink
    I'm workin on a two-column layout, with navigation and misc. things in the left hand column, and the main content/articles/etc. in the right hand column. So far this layout is looks the same in FireFox, IE and Opera. I just want to make sure its not too "hacky" or "divy." Everything that will go into the left and right columns will not being using divs. For example I will set up navigation using <a> set to display: block. Anyway here's the CSS and HTML any opinions or ides would be great. Oh, yeah...the reason I set it up this way was to avoid having to use any box model hacks.

    CSS:
    /* Start Site Layout */
    body {
    margin: 0px;
    text-align: center;
    background: #B2A997;
    }
    #container {
    width: 760px;
    margin: 10px auto 0px auto;
    }
    #banner {
    float: left;
    width: 760px;
    height: 190px;
    background: url(images/banner.jpg);
    background-repeat: none;
    }
    #container2 {
    float: left;
    width: 760px;
    margin: 0px;
    background: url(images/background.jpg);
    }
    /* Start Container2 Items */
    .thirty {
    float: left;
    width: 30px;
    height: 30px;
    margin: 0px;
    }
    #left {
    float: left;
    width: 210px;
    height: 120px;
    margin: 0px;
    background: #CCCCCC;
    }
    .ten {
    float: left;
    width: 10px;
    height: 30px;
    margin: 0px;
    }
    #right {
    float: left;
    width: 480px;
    height: 120px;
    margin: 0px;
    background: #CCCCCC;
    }
    /* End Container2 Items */
    #footer {
    float: left;
    width: 760px;
    height: 30px;
    background: url(images/footer.jpg);
    }
    /* End Site Layout */


    HTML (this is what I have between the body tags):
    <div id="container">

    <div id="banner"></div>

    <div id="container2">
    <div class="thirty"></div>

    <div id="left"></div>

    <div class="ten"></div>

    <div id="right"></div>

    <div class="thirty"></div>
    </div>

    <div id="footer"></div>

    </div>

    The three "invisible" columns are used to align the two main columns. Then the block elements that go into those two columns will be able to fill their entire width. So hopefully the only cross-browser differences will be slight variations in the vertical spacing of what I put into the two main columns.
    •  
      CommentAuthornifkin
    • CommentTimeJun 29th 2006 edited
     permalink
    Couldn't you just lose the .ten and .thirty classes and divs entirely and just manage that using margins?

    Tangental: if you want a simple system for building up layouts quickly that's been pretty flexible in my playing with it so far (and automates a lot of the hacking and such for this kind of thing), you could take a look at the Yahoo! UI Library Grids CSS.
    • CommentAuthorJosh
    • CommentTimeJun 29th 2006 edited
     permalink
    Using margins yields different results depending on the browser. Unless you use a box model hack.
    •  
      CommentAuthorJohnRiv
    • CommentTimeJun 29th 2006
     permalink
    nifkin's right. Box model discrepancies only become an issue when you're dealing with padding and border. Margins aren't an issue.
    •  
      CommentAuthornifkin
    • CommentTimeJun 29th 2006
     permalink
    Margins aren't an issue.

    Unless you're dealing with the IE doubled-float-margin bug. Which display:inline; still does fix.
    • CommentAuthorJosh
    • CommentTimeJun 29th 2006
     permalink
    Nifkin,

    You are correct, it was the double float margin bug in IE. Thanks! My code is now much cleaner.
Add your comments
    Username Password
  • Format comments as (Help)