Solution (Conditional Comments Solutions)
Date of the Solution
Mon Aug 17 22:47:07 2009
Fixed Versions
All of the affected
Description
The fix for this bug is a rather brute-force hack. Let's take a look:
Fixed demo is available on a separate page
- HTML Code:
<form action="">
<div>
<input type="text" name="ber"><br>
<textarea cols="10" rows="5" name="baz"></textarea><br>
<select name="ber"><option>foo</option></select><br>
</div>
</form>
- CSS Code:
div {
margin-left: 100px;
width: 100%; /* gives "layout" */
}
- Conditional Comments Code:
<!--[if lte IE 7]>
<style type="text/css">
input,
textarea {
margin-left: -100px;
}
</style>
<![endif]-->
Let's break down what I did here. This is the only fix I have found so far. I have used conditonal comments to target IE6 and IE7 - feel free to use whatever method you like to do that. For those specific IE versions I've set negative margin-left equal to the margin-left set on the ascendant (except negative, of course) on our <input> and <textarea>. Now both of those elements align with <select> in affected browsers just as they supposed to. The same principle would apply for margin-right. Just a note: you're not mean to use the same selector I've used, make sure to localize the negative margin for it to be applied only on form elements that manifest this bug.