Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2007
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DIV height of 5px does not work in IE6

    I am using this code to get a div to sit with a 5px height:

    .contentleftblueheader {
    background: #0053A0;
    width: 238px;
    height: 5px;
    margin: 0 0 10px 0;
    }

    No problems in IE7 or Firefox but good old IE6 does not like it. Does anybody have any ideas?

  • #2
    Regular Coder BonRouge's Avatar
    Join Date
    Mar 2006
    Location
    Sendai, Japan
    Posts
    328
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #3
    Senior Coder koyama's Avatar
    Join Date
    Dec 2006
    Location
    Copenhagen, Denmark
    Posts
    1,246
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Hello BonRouge, you are suggesting this fix:
    Code:
    #thediv {
      font-size: 0;
    }
    Just for your information, I have had problems with the font-size: 0 method when the div needs to go below 2px in height. Sometimes it works and sometimes it doesn't.

    When trying to make a div small in height, it also seems to matter whether the div is empty or not. Even a single comment node can make difference.

    One might also consider using overflow: hidden as an alternative which for some reason seems to be working also for divs smaller than 2px.

  • #4
    Senior Coder
    Join Date
    Jan 2005
    Location
    Memphis, TN
    Posts
    1,785
    Thanks
    8
    Thanked 131 Times in 129 Posts
    the problem is this cool little thing that you need to put px behind a font-size: 0;

    Code:
    what {
    font-size: 0px;
    }
    you might need to adjust line height as well but maybe not.
    Stop making things so hard on yourself.
    i is tugbucket :: help raise tugburg :: Whitehaven Kiwanis

  • #5
    Regular Coder BonRouge's Avatar
    Join Date
    Mar 2006
    Location
    Sendai, Japan
    Posts
    328
    Thanks
    0
    Thanked 0 Times in 0 Posts
    koyama, harbingerOTV:
    Yeah, those methods both work too. I should add those to my page. I didn't realize that there were problems with just setting the font-size to 0 though. I've never seen problems with that.

    harbingerOTV:
    You don't need to put 'px' after '0' at all. '0' is '0' in any unit.
    Last edited by BonRouge; 05-10-2007 at 04:26 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •