2016-04-02 85 views

回答

3

尝试使用下面的代码:

.modal-dialog { 
    position: absolute; 
    margin: 0; 
    transform: translate(-50%,-50%) !important; 
    /*^dont forget to prefixize this^*/ 
    top: 50%; 
    left: 50%; 
} 
+0

这是正确的。只需要-webkit前缀。 – dfsq

+0

以上作品。但我不知道在哪里以及如何使用-webkit前缀。建议? – Laura

+0

@Laura只需添加额外的规则:'-webkit-transform:translate(-50%, - 50%)!important;' –

0

.modal-dialog { 
 
    position: absolute; 
 
    margin: 0; 
 
    transform: translate(-50%,-50%) !important; 
 
    -webkit-transform: translate(-50%,-50%) !important; 
 
    -moz-transform: translate(-50%,-50%) !important; 
 
    -o-transform: translate(-50%,-50%) !important; 
 
    -ms-transform: translate(-50%,-50%) !important; 
 
    top: 50%; 
 
    left: 50%; 
 
}

上面会的所有前缀

+0

前缀使模态内部的窗体消失,窗体显示在页面顶部而不是中间。 – Laura

+0

尝试使用没有评论 –