I have a problem with input field width [text] in IE, in all versions.
I have a div with an explicitly set width of 250px. In this div, I have an input text box with a width set to 100%. This input also has an internal left padding of 10px.
In IE, it displays the width as 100% + 10px. I cannot determine the method for restricting the width of the container.
This problem initially occurred in all browsers, but it was very easy to fix in FF, Safari, and Chrome by adding max-width: 100%. IE6 / 7 does not support this, while IE8 does, but it also adds an addition to the width.
I understand that the IE box model includes the border and margin in the width calculations, so given what is understood, I still cannot figure out how to do this.
I am also trying to find a better solution than just setting the input width to 240px with padding, because there are various inputs on this form whose containers vary in size, and I would like to find a universal solution.
Here is the code:
<div class="places_edit_left">
<h4>PHONE <strong>(NOT USER EDITABLE)</strong></h4>
<input type="text" value="" name="phoneNumber"/>
<h4>ADDRESS<strong>(NOT USER EDITABLE)</strong></h4>
<input type="text" value="" name="address"/>
</div>
CSS
.places_edit_left{ width:250px; }
.places_edit_left input{ width:100%; max-width:100%; padding-left:10px;}
bob
source
share