I have this html:
<div class="lightbox">
<div class="lightbox-content-wrapper">
<div class="lightbox-content-inner-wrapper">
<div class="lightbox-content">
<!-- Popup Form -->
<div class="lightbox-form-wrapper">
Test
</div>
</div>
</div>
</div>
</div>
同时需要使用以下CSS:
.lightbox {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #000;
background: rgba( 0, 0, 0, .7 ) repeat;
}
.lightbox-content-wrapper {
background-color: #FFF;
width: 20%;
position: fixed;
bottom: 0;
top: 0;
left: 0;
right: 0;
margin: auto;
display: table;
text-align: center;
border: 10px solid #2980B9;
}
这是fiddle链接:http://jsfiddle.net/p2omaw29/1/。我想创建一个居中显示的lightbox。如果您在Chrome和Firefox中打开fiddle,您会看到它们呈现不同的结果。在Chrome中,盒子位于屏幕正中央,而在Firefox中,它位于顶部,好像bottom: 0;规则无效。那么,究竟是什么导致了这种差异?我已经花费了一个小时来调整一些CSS,但没有任何进展。非常感谢!
left: 0
部分解决了我的问题 :) - Matthias