我有2个div应用最大宽度代理他们,因为我想。一个最大宽度为900px,而另一个为820px,如果窗口尺寸变小,它们会缩小。中心格与最大宽度
<div id="componentWrapper">
<div class="thumbContainer"></div>
</div>
#componentWrapper{
position:absolute;
height:190px;
width:100%;
max-width:500px;
top:50%;
background:red;
margin-top:-85px;
}
#componentWrapper .thumbContainer{
top:0px;
left:0px;
height:180px;
max-width:420px;
margin-left:40px;
margin-right:40px;
background:green;
overflow:hidden;
}
我想现在纯CSS如果可能的话这个中心里面的窗口。即使窗口的大小小于外部元素的当前宽度,它也需要保持居中。
似乎按照您为我描述的方式工作,或者我错过了什么? – byronyasgur 2013-02-20 20:04:50
在FF中似乎没问题。 – 2013-02-20 20:05:15