padding a text input in IE… possible?

前端 未结 9 1369
逝去的感伤
逝去的感伤 2020-12-14 07:54

I have a text input with a search buton absolute positioned over it... to make space for the button I used some padding to keep the text from going under the button, which i

相关标签:
9条回答
  • 2020-12-14 08:36

    Try border-right instead of padding-right. This worked for me.

    0 讨论(0)
  • 2020-12-14 08:37

    What about declaring DOCTYPE?

    By adding <!DOCTYPE html> padding works grand for me in IE8. Take the following code as an example:

    <!DOCTYPE html>
    <html>
      <head>
        <style>
          #myInput {
            padding: 10px;
          }
        </style>
      </head>
      <body>
        <input id="myInput" value="Some text here!" />
      </body>
    </html>
    
    0 讨论(0)
  • 2020-12-14 08:40

    try using line-height

    0 讨论(0)
  • 2020-12-14 08:40

    I experienced a similar problem - IE was padding the input field, but not making it bigger, thus pushing the text down inside of it. I fixed it by setting the height of the input as well. Try that.

    0 讨论(0)
  • 2020-12-14 08:43

    I have the following working in IE7. What version are you targeting?

    <style type="text/css">
    
        input#test {
            padding: 10px;
        }
    
    </style>
    
    
    <input type="text" id="test" />
    
    0 讨论(0)
  • 2020-12-14 08:45

    Make your input transparent and place styles inside a container div:

    http://jsfiddle.net/LRWWH/211/

    HTML

     <div class="input-container">
     <input type="text" class="input-transparent" name="fullname"> 
     </div>
    

    CSS

     .input-container {
        background:red;
        overflow:hidden;
        height: 26px;
        margin-top:3px;        
        padding:6px 10px 0px;
        width: 200px;
      }
    
     .input-transparent {
        background-color:transparent;
        border:none;
        overflow:hidden;        
        color:#FFFFF;
        width: 200px;
        outline:none;
      }
    
    0 讨论(0)
提交回复
热议问题