我有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