如何在IE 9,10,11中居中"position:absolute"元素,我的例子在Internet Explorer中不起作用.这个"位置:绝对;左:50%;保证金左:-20px;" 方式不适合我,因为布局是响应性的.
.box{
position: absolute;
top: 150px;
right: 0;
left: 0;
margin: auto;
}
<body>
<div class="container">
<div class="box">
</div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
Saj*_*ath 24
<body>
<div class="container">
<div class="box">
</div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
CSS
.box{
position: absolute;
top:0;
right: 0;
left: 0;
bottom:0; //specify all including bottom:0
margin: auto;
height:200px;
width:200px;
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
24163 次 |
最近记录: |