Flupke
19 Aug 2010, 11:31 AM
I have the following situation:
<!DOCTYPE html>
<html lang="en" class="jsPop" id="noJS">
<head>
<title>Float followed by margin</title>
<style>
.label {float:left; width:9em; text-align:right;}
.control {background:red; margin-left:11em; margin-bottom:1em; position:relative;}
.control input {position:relative; margin:0; padding:0;}
</style>
</head>
<body>
<div class="box">
<div class="row">
<div class="label">Choose something</div>
<div class="control"><input type="checkbox" id="field1" name="field" /> <label for="field1">Option 1</label></div>
<div class="control"><input type="checkbox" id="field2" name="field" /> <label for="field2">Option 2</label></div>
</div>
</div>
</body>
</html>
There's a label that is floated and has a fixed width, and there are control items that have a left margin to make them line up.
This works fine in all browsers except IE6. In IE6, an extra whitespace is added to the first control item.
Example code can be found here: http://users.telenet.be/fluppe/testing/float-margin-ie6-issue.html
Any suggestions?
<!DOCTYPE html>
<html lang="en" class="jsPop" id="noJS">
<head>
<title>Float followed by margin</title>
<style>
.label {float:left; width:9em; text-align:right;}
.control {background:red; margin-left:11em; margin-bottom:1em; position:relative;}
.control input {position:relative; margin:0; padding:0;}
</style>
</head>
<body>
<div class="box">
<div class="row">
<div class="label">Choose something</div>
<div class="control"><input type="checkbox" id="field1" name="field" /> <label for="field1">Option 1</label></div>
<div class="control"><input type="checkbox" id="field2" name="field" /> <label for="field2">Option 2</label></div>
</div>
</div>
</body>
</html>
There's a label that is floated and has a fixed width, and there are control items that have a left margin to make them line up.
This works fine in all browsers except IE6. In IE6, an extra whitespace is added to the first control item.
Example code can be found here: http://users.telenet.be/fluppe/testing/float-margin-ie6-issue.html
Any suggestions?