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 4 of 4
  1. #1
    EZE
    EZE is offline
    New Coder
    Join Date
    Jan 2007
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    1px height div tag

    Okay, I used css to style a div tag, making it 1px in height, and it comes out great, in fact almost everything I code comes out excellent in firefox, but not in ie7, which is the browser client that most people use. Anyways, the div tag shows up in regular height. Anyone no why or how to code it alternatively?
    Code:
    <div style="background-color:#000000;height:1px;width:100%;"></div>

  • #2
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,300
    Thanks
    28
    Thanked 275 Times in 269 Posts
    Try font-size: 0; if that doesn’t work, try line-height: 0. I know that Internet Explorer has a bug that forces a minimum height equal to that of one line of text unless you use one or both of the previous declarations anyway. I think you need to add a (pixel) unit or something to the second one (if used) despite the value being zero though.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #3
    EZE
    EZE is offline
    New Coder
    Join Date
    Jan 2007
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks! The font-size worked, i didn't try line height though. I still like firefox 2 better than ie7.

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    No need to specify width:100%; as divs by default unless they are floated, set to display:inline, or position:absolute will take up the full width of its containing element.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

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