Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

div height different in IE6

Options
  • 07-05-2009 3:59pm
    #1
    Registered Users Posts: 8,070 ✭✭✭


    anyone have this problem?
    [PHP]#main{
    background-image: url(back2.png);
    background-repeat: repeat-y;
    position:relative;
    margin-left:auto;
    margin-right:auto;
    margin-top:60px;
    width:900px;
    height:550px;



    } [/PHP]


    basically have to change the height to 560 in IE6, but then its too big in other browsers


Comments

  • Closed Accounts Posts: 1,200 ✭✭✭louie


    is because of the margin-top
    try another div inside the main div.
    <div id='main'>
      <div id='in_main' style='height:60px;'></div>
      your content here
    </div>
    


  • Registered Users Posts: 8,070 ✭✭✭Placebo


    i have another div there, i tried various things, ended up using a table.
    TABLES never fail


  • Registered Users Posts: 1,829 ✭✭✭KerranJast


    Tables nearly alway fail when you want to style the contents. Divs are W3C recommended. I tried your code it works fine. You must have something else around it affecting it.


  • Users Awaiting Email Confirmation Posts: 351 ✭✭ron_darrell


    Unfortunately IE uses a different box model to the other browsers. Fortunately there is a relatively simple fix :)
    #main{ 
    background-image: url('back2.png'); 
    background-repeat: repeat-y; 
    position:relative; 
    margin-left:auto; 
    margin-right:auto; 
    margin-top:60px; 
    width:900px; 
    height:550px; 
    #height:560px;
    }  
    
    

    or if you prefer
    #main{ 
    background-image: url(back2.png); 
    background-repeat: repeat-y; 
     position:relative; 
    margin-left:auto; 
    margin-right:auto; 
    margin-top:60px; 
    width:900px; 
    height:560px; 
    }  
    
    html>body #main {
    height: 550px;
    }
    

    Regards,
    RD


  • Closed Accounts Posts: 275 ✭✭Hydrosylator


    #main{ 
    background-image: url(back2.png); 
    background-repeat: repeat-y; 
     position:relative; 
    margin-left:auto; 
    margin-right:auto; 
    margin-top:60px; 
    width:900px; 
    height:560px; 
    }  
    
    html>body #main {
    height: 550px;
    }
    

    Regards,
    RD

    That's the way I'd do it usually. In a perfect world of course, I wouldn't have to. Flippin IE.


  • Advertisement
  • Registered Users Posts: 8,070 ✭✭✭Placebo


    #height:560px;


    thanks, never seen this before, source?


  • Moderators, Science, Health & Environment Moderators Posts: 8,956 Mod ✭✭✭✭mewso


    Because IE6 will often present more then one problem I've taken to using conditional comments these days:-
    <!--[if lt IE 7]>
    <link rel="stylesheet" type="text/css" href="style_ie6.css" />
    <![endif]-->
    

    This style sheet will only have an effect on IE6 or earlier versions of IE and I can add to it specifically to fix problems. Prefer it to hacks tbh.


Advertisement