2015-12-02 73 views
0

我想建立一個時間表,顯示一系列的事件,可能有很多的事件添加到時間線上,以便其容器被設置爲自動排列,視覺的目的我的代碼這裏:http://codepen.io/tomevans1664/pen/QyLObL。這一切都可以在Chrome中正常工作,但在IE中,垂直時間線欄不受溢出限制。自動流不是絕對定位的div工作在IE

HTML:

<div class="center"> 
     <div class="timeline"> 
      <div class="line"> 
      </div> 
      <div class="content"></div> 

     </div> 
    </div> 

CSS:

body{ 
    margin: 0; 
    padding: 0; 
} 
.center{ 

    margin-left: auto; 
    margin-right: auto; 
    width: 800px; 
    height: 500px; 
    border: 1px solid #dddddd; 
    overflow-y: auto; 
    overflow-x: none; 
} 
.line{ 
    position: absolute; 
    top: 0; 
    left: 50%; 
    height: 100%; 
    width: 5px; 
    background: #d7e4ed; 
} 
.content{ 
    height: 1000px; 
} 
.timeline{ 
    position: relative; 
    width: 100%; 
    min-height: 50px; 
} 

IE截圖: http://imgur.com/0pUVtOi

+0

什麼是'溢出-X:無;'應該是什麼? –

+0

這是強制搭售我刪除的滾動條在IE中,隨意改變兩個單獨的溢出到溢出:汽車 –

回答

0

所以它的出現,爲IE瀏覽器,該溢出絕對定位的內容,包含div有溢出屬性也必須使用絕對定位,儘管這會破壞自動邊距。

若要.center再次集中,我用:

left: 50%; 
    transform: translate(-50%, 0); 
    -ms-transform: translate(-50%, 0);