Many of us might have faced this issue especially in IE browsers, issue goes like this! when we apply a background-image property to a simple html textbox and when someone puts a very long text in the input text field, we see that the background image will be running-out with the text! its a strange one. The background-image property works fine in all major browsers but coming to IE browsers from old browsers to latest browsers we can see this issue. Its a quite interesting issue, but we do have a work-around for the same. Below screen-shots depicts how the scenario of this issue would be:
In the below screen-shot if you see, I have a input textbox applied some background image to it! it looks good when there is no text inside the textbox. But, as on when user puts a very long text in the input textbox, we see that the background image is running-out with the text! did you see that! – isn’t it strange and weird!
Looks good without text:
Looks Strange and weird when long text is entered:
Is there any solution for this! Yes! we do have a work-around for the same. Below CSS code will solve this issue in IE browsers.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | div.inputWrapper{ background: #d0ecf0 url('images/txt_bg.gif') no-repeat left top; width:460px; } div.inputWrapper input.inputbox-without-issue{ border: 0px; padding:8px; height: 29px; width: 440px; background-color: transparent; font-family:Arial, Helvetica, sans-serif; color:#FFFFFF; font-size:25px; } |
Below is the HTML code:
1 2 3 | <div class="inputWrapper"> <input type="text" class="inputbox-without-issue" /> </div> |
Below is the entire HTML code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>IE Issue: Background-image running out for input textbox</title> <style type="text/css"> .roundedcorner-container { padding: .5em 2em .55em; text-shadow: 0 1px 1px rgba(0,0,0,.3); -webkit-border-radius: .5em; -moz-border-radius: .5em; border-radius: .5em; -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2); -moz-box-shadow: 0 1px 2px rgba(0,0,0,.2); box-shadow: 0 1px 2px rgba(0,0,0,.2); padding-top:33px; height:73px; border: solid 1px #69a4c2; background: #d0ecf0; background: -webkit-gradient(linear, left top, left bottom, from(#ebf8f9), to(#c0dde2)); background: -moz-linear-gradient(top, #ebf8f9, #c0dde2); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ebf8f9', endColorstr='#c0dde2'); } input.inputbox-with-issue{ font-family:Arial, Helvetica, sans-serif; color:#FFFFFF; font-size:25px; width:440px; background:#d0ecf0 url('images/txt_bg.gif') no-repeat left top; border: 0; padding:10px; height: 25px; } div.inputWrapper{ background: #d0ecf0 url('images/txt_bg.gif') no-repeat left top; width:460px; } div.inputWrapper input.inputbox-without-issue{ border: 0px; padding:8px; height: 29px; width: 440px; background-color: transparent; font-family:Arial, Helvetica, sans-serif; color:#FFFFFF; font-size:25px; } </style> </head> <body> <h1>Background-Image Issue [View in IE Browser]:</h1> <p>Below inputbox looks good, when there is no text. But when we enter a long-text, you can see background image of input box will run out of the box. If you could not believe! start entering a text in the below inputbox provided.</p> <div class="roundedcorner-container"> <input type="text" class="inputbox-with-issue" /> </div> <h1>Work-around for Background-Image Issue [View in IE Browser]:</h1> <p>Below is the work-around for the known issue of background image with input box.</p> <div class="roundedcorner-container"> <div class="inputWrapper"> <input type="text" class="inputbox-without-issue" /> </div> </div> </body> </html> |
This article might help developers in resolving background image issue which occurs with input textbox. If let me know your suggestions through the comments box provided below.
Related Entries...
Introduction: After going through this article, you can be able to develop a simple slide panel appl ...
Introduction This post help beginners to learn and implement some jQuery Web Applications. Develop S ...
Introduction to jQuery jQuery is one of the best and well known JavaScript Libraries. Using this you ...
Introduction: This article will help you in developing simple Floating Slide-In Menu using jQuery. T ...
This is an awesome jQuery plugin like Jondesign's Smooth Slideshow v2.1, by looking at the jd's Smoot ...
You might have come across weird situations where a long text inserted into a table cell or into a we ...
I am back again with some good snippet on "Placing a Play Icon over the image using CSS", After going ...
This article will helps you to understand on how you can increase and decrease font-size of the conte ...
In your development, in some scenarios you might not required the dotted lines on buttons to be appea ...
Hey folks, hmmm... How can I start.... !!! Yeah, well folks... below is very simple snippet code for ...






















4 Responses
Я заметил, некоторые блоггеры любят провоцировать читателей, некоторые даже сами провокационные комменты оставляют сами у себя на блоге
yo, faced this sometime back.. cant recall wht i did.. but this is nice – tnx for the tip, mate
Как обычно просто супер обьёмная статья и как всегда дочитал до конца
Finally, an issue that I am passionate about. I have looked for information of this caliber for the last several hours. Your site is greatly appreciated.