Frontendplace Blog

Sharing Frontend developing ideas

Shifting inputbox in IE

Posted by info on April 9th, 2007

Just noticed some strange behaviour in IE6 (off course). I have a form with labels and inputboxes.
When I don’t have a space inside or outside a span (with a class: floated right, display block and with a specific width.) and put right after it an inputbox, than the inputbox gets about 2 pixels shifted to the right.
When I place a space inside or outside the span ( in front of the inputbox) the inputbox shifts back again!!!

OK with CR after span
<label for="name"><span class="label">Name</span>
<input name="name" type="text" id="name" value="" />
</label>

Or with space inside span
<label for="name"><span class="label">Name </span><input name="name" type="text" id="name" value="" />
</label>

OR with space outside span
<label for="name"><span class="label">Name</span> <input name="name" type="text" id="name" value="" />
</label>

WRONG (no space inside or ouside span)
<label for="name"><span class="label">Name</span><input name="name" type="text" id="name" value="" />
</label>