Fix IE7 scrolling background problem in textarea form fields

Fix IE7 scrolling background problem in textarea form fields

IE6-7 incorrectly scrolls an applied element background for textarea field or overflows an input field in forms. Even the most common css hack suggested is to use the fixed position for background attachment, sometimes this isn’t enough.

reADactor

Try to be a mixer of inspiration, source of tutorials, tips and a reactor of your future design ideas, a place from where you can download freebies, vectors and web templates. Follow us on Twitter and Facebook

form-IE7-problem

The problem is screen printed above. The css background attachment property loaded like default in IE6-7 is “scroll”. For IE6 you can make the background attachment “fixed” and no more scrolling. Not so with IE7.

Since Microsoft “corrected” the background attachment issues with IE7 and now is no way of having an overflow of text in a input or textarea element and not having the background scroll with the text, and if you try “background-attachment: fixed;” the background doesn’t even display.

fix-IE7-textarea


Because is no really css hack what fix the problem, you need to think out of css. Instead to style just the textarea element, make a supplementary div like container for textarea and apply the background image to the div, instead to textarea. Let the textarea without border and background to make a proper overlay.

#contactForm textarea {
border:none;
background:none;
width:200px;
height:85px;
color:#c8c8c8;
padding:10px 0 0 10px;
overflow:hidden;
}

#contactForm .textarea {
width:215px;
height:100px;
background: url(../images/input-text.png) no-repeat;
}

contact-form

Published on: January 23rd in Tutorials .
Post tags: , , , , , , , , , , ,

3 Comments

  • pharmacy tech
    January 23, 2010
  • bug
    February 11, 2010
    • reADactor
      February 11, 2010

Leave A Comment.