SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    remove height of <div> in IE?

    I can't get any <div> to have zero height in Internet Explorer. In Mozilla it works just fine. I use the following code to style a <div> as a horizontal rule:
    Code:
    div.hr {
       height: 2px;
       border: 0px;
       background-repeat: repeat-x;
       background-image: url(dotted_hr.gif);
       margin: 0px;
       padding: 0px;
      }
    Now there is always some spacing below the background-image, that has a height of 2px. Any idea on how to remove this?

  2. #2
    SitePoint Zealot
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In the mean time I've found out that this is a bug in IE and Opera. It is not possible to get a <div> to have less than 20px of height. I will have to look for an alternative...

  3. #3
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,274
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    The answer's simple just add overflow:hidden otherwise ie adds room for the line-height of the specified font.

    Paul

  4. #4
    Ceci n'est pas Zoef Zoef's Avatar
    Join Date
    Nov 2002
    Location
    Malta
    Posts
    1,111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Think I once did 'font-size:0' and that helped as well. But I'm not sure now... (it's late).

    Rik
    English tea - Italian coffee - Maltese wine - Belgian beer - French Cognac

  5. #5
    SitePoint Zealot
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Didn't know it was that simple

    Thanks guys


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
  •