I have a form on my page and I want to position all of the text boxes so that the left edges are all in line with each other.
I have written the following code, which works fine in Firefox:
<style type="text/css">
label {
float: left;
clear: both;
width: 250px;
margin-top: 10px;
}
input {
float: left;
margin-top: 10px;
}
</style>
<label>First Name:</label>
<input type="text" name="fname">
<label>Last Name:</label>
<input type="text" name="lname">
<label>Phone Number:</label>
<input type="text" name="phone">
However when viewed in IE6 the text boxes are all on one line where the labels are positioned as I want them to be. I have been trying to sort the problem for hours and the only thing I can come up with is to place a span inbetween each label/textbox combination which clears the float, like so:
<label>First Name:</label>
<input type="text" name="fname">
<span style="clear: both;"></span>
<label>Last Name:</label>
<input type="text" name="lname">
<span style="clear: both;"></span>
<label>Phone Number:</label>
<input type="text" name="phone">
However I know this is not correct as having empty elements are not allowed. Any ideas how I can get around my problems and get the layout the same in both browsers.
Thanks