Aligning HTML controls at not happening despite having same LEFT point...?
How these two controls line up with each other without having to add any more div's?? I've set them both at Left:140px but they still don't align.
<pre>
<span id="l4" disabled="disabled" style="display:inline-block;font-family:Arial;font-size:9pt;font-weight:bold;width:117px;">date</span><input
name="date?4" type="text" value="1/1/2011 12:00:00 AM" id="date?4" runat="server" style="border-color:Black;font-family:Arial;width:300px;left: 140px" />
</br></br>
<span style="font-family: Arial; left: 140px;position: relative;"><input id="chkAll?5" type="checkbox" name="chkAll?5"/>
<label for="chkAll?5">Select All</label></span>
<div id="divChkLst?5"
style开发者_如何学Python="left:140px;width:300px;height:125px;position:relative;display:block;border-style:solid;border-width:thin;margin:0;border-color:Black;padding:0;
overflow:auto;">
<table id="pMultiValueList?5" border="0" style="font-family: Arial;">
<tr>
<td><span pTag="ReportParameter5"><input id="pMultiValueList?5_0" type="checkbox" name="pMultiValueList?5$0" checked="checked"
/><label for="pMultiValueList?5_0">qw</label></span></td>
</tr><tr>
<td><span pTag="ReportParameter5"><input id="pMultiValueList?5_1" type="checkbox" name="pMultiValueList?5$1" checked="checked"
/><label for="pMultiValueList?5_1">as</label></span></td>
</tr><tr>
<td><span pTag="ReportParameter5"><input id="pMultiValueList?5_2" type="checkbox" name="pMultiValueList?5$2" checked="checked"
/><label for="pMultiValueList?5_2">zx</label></span></td>
</tr><tr>
<td><span pTag="ReportParameter5"><input id="pMultiValueList?5_3" type="checkbox" name="pMultiValueList?5$3" /><label
for="pMultiValueList?5_3">er</label></span></td>
</tr>
</table>
</div>
</div></br></br>
</pre>
You can't set the left attribute on relatively positioned elements. (Well, you can but it won't have any effect.) One option is to set
position:absolute;
But you will have to actually position them absolutely, and set a top/bottom value.
Edit:
As mentioned below in the comments, you could offset the left values appropriately, if you put them both at 140px and they were not aligned to begin with, they will still be off by the same number of pixels.
精彩评论