更新了布局的提供上下文
I have a relatively simple structure for my page. The page is composed of two div's both absolutely positioned. One is centered within the other.
<div id="protocol_index_body_wrapper">
<div id="protocol_index_body">
</div>
</div>
其中有对应的CSS:
#protocol_index_body_wrapper {
background: url("/images/stripe.png") repeat scroll 0 0 transparent;
position: absolute;
top: 120px;
left: 0px;
right: 0px;
bottom: 10px;
}
#protocol_index_body {
width: 960px;
margin: 0 auto;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
预期的行为如上图所示。此行为存在于 IE8、Firefox 和 Chrome 中。然而,在 IE7 中,应该居中的 div 与左侧齐平。有任何想法吗?
尝试这个:
#protocol_index_body {
width: 50px;
margin: 0 auto 0 -25px;
position: absolute;
top: 0;
left: 50%;
right: 0;
bottom: 0;
background-color: red;
}
Or ...
#protocol_index_body {
width: 50px;
margin: 0 auto 0 50%;
position: absolute;
top: 0;
left: -25px;
right: 0;
bottom: 0;
background-color: red;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)