I have two elements that I am trying to line up, a text box and a span. In order for them to line up and look nice in firefox I use:
<input id="myTextBox" style="float: left; margin-right: 5px; position: relative; left: 13.5em; bottom: 1.5em;" type="text" />
<span style="visibility: visible; position: relative; left: 12.5em; bottom: 1.5em;">Enter stuff in the box </span>
However in IE 8 the text box is on top of the span, cutting off the text. If I change the left: 13.5em; to left: 11.8em; it lines up nice in Internet Explorer, but then is off center in Firefox. I am using decorators in a Zend Form so I have to use the inline styles. Is there any way to make the position line up in both browsers?
As your
<input>is floating, it might make more sense to usemargin-left:10%instead ofposition:relativeandleft:10%? Similarly for your span, I would make itdisplay:block;margin-left:10%;clear:left;rather thanposition:relative;.I’ve used
10%because usingemfor layout has given me cross-browser issues in the past – I only use it for text-based things now.