Form field height

Discussion in 'CSS' started by hasbehas, Apr 4, 2008.

  1. #1
    I am trying to set height for a form field.

    
    <div style="height:20px;padding:0px;">
      <form id="searchbox_0003.......... />
        <input type="hidd........." />
        <input type="imag........." />
      </form>
    </div>  
    
    Code (markup):
    the 20px works in firefox but not in ie7

    any idea why or is my code wrong ?
     
    hasbehas, Apr 4, 2008 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #2
    If you don't set overflow to hidden, IE will treat height as if it was min-height. The reason it's growing (I assume) is that the height of your content is taller than that 20px.

    Honestly, I'd never set a height that way around a form element - their sizes are too unpredictable cross browser to try and fix the height unless you do it ON the elements themselves.
     
    deathshadow, Apr 4, 2008 IP
    hasbehas likes this.
  3. hasbehas

    hasbehas Well-Known Member

    Messages:
    726
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    190
    #3
    Thanks man...
    <div style="height:20px;overflow:hidden;">
    has taking care of the problem..

    What you mean is that, rather then div style around form element , style the form ?
     
    hasbehas, Apr 5, 2008 IP