[英]Internet Explorer: relatively positioned button alignment in absolutely positioned box
在IE7中,我的订单示例按钮“ #itmSampl”与左侧的“ .add-to-cart”按钮没有垂直对齐,尽管在FF3.6和Chrome 5中是这样。 我需要它在IE6-8中正确对齐。 有人看到我想念的东西吗?
<style type="text/css">
#buttonbox { position:relative; width:326px; }
#accounting #box-accounting .image-item .content-account .add-to-cart { clear:both; margin:0 0 10px; }
#accounting #box-accounting .image-item .content-account
#ordrWizrd { float:left; height:24px; width:111px; }
#accounting #box-accounting .image-item .content-account .add-to-cart { clear:both; margin:0 0 10px; }
#itmSampl { bottom:0; cursor:pointer; display:block; height:24px; margin:0 3px 2px; position:absolute; right:0; width:120px; } .clearfix { clear:both; height:0; } </style>
<div id="buttonbox">
<div id="addtocart2" class="add-to-cart">
<table><%=getCurrentAttribute('item','addtocarthtml')%></table>
</div>
<div id="ordrWizrd" class="add-to-cart"><a href="javascript:shwWizd()"><img src="/images/img/add-to-cart.gif" alt="configure item"></a></div>
<div id="itmSampl"></div>
</div> <div class="clearfix"></div> </div>
另外,如果视觉效果有所帮助,这是测试页(您必须登录才能看到按钮而不是项目符号列表): http : //www.avaline.com/85W_test_2登录:test2@gmail.com通过:test03
解决方案1 :由于您已经在页面中使用了很多表,因此另一个表也不会受到伤害-只需将HTML从上面的内容更改为类似的内容(可能需要进行一些调整):
<div id="buttonbox">
<div id="addtocart2" class="add-to-cart">
<table><tr>
<td><table><%=getCurrentAttribute('item','addtocarthtml')%></table></td>
<td valign="bottom"><div id="itmSampl"></div></td>
</tr></table>
</div>
<div class="clearfix"></div>
</div>
<!-- And also put #ordrWizrd in there somewhere -->
解决方案2 :使用#itmSampl删除所有“位置:绝对”的内容(删除CSS的bottom,position,right以及margin和height / width属性)。 然后,添加CSS float: right; margin-top: -36px;
float: right; margin-top: -36px;
到#itmSampl使其浮动在右侧并向上移动36像素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.