我的目标是实现如图所示的灯箱:
黑色是一个必须“隐藏”的页面,不透明度大约为.6
红色是带有背景色/图像的主框
描述和“x”都在红色背景之上
它也应该是有反应的。有人能帮我吗?
到目前为止我试过的:
.modal {
display: none;
position: absolute;
z-index: 998;
padding-top: 100px;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0,0.9);
text-align: center;
}
.modal-content {
margin: auto;
display: block;
min-height: 150px;
z-index: 999;
}
.top{
width:100%;
top: 0;
text-align: right;
direction: rtl;
position: absolute;
height:15px;
}
.ico{
width:15px;
height: 15px;
background-color: blue;
position: relative;
}
#caption {
width:90%;
background-color: rgba(100, 100, 100, 0.7);
color: white;
padding-left: 16px;
text-transform:uppercase;
height:50px;
margin-top: -50px;
z-index: 9999;
position: relative;
}
.modal-content, #caption {
-webkit-animation-name: zoom;
-webkit-animation-duration: 0.6s;
animation-name: zoom;
animation-duration: 0.6s;
}
@-webkit-keyframes zoom {
from {-webkit-transform:scale(0)}
to {-webkit-transform:scale(1)}
}
@keyframes zoom {
from {transform:scale(0)}
to {transform:scale(1)}
}
.close {
position: absolute;
top: 15px;
right: 35px;
color: #f1f1f1;
font-size: 40px;
font-weight: bold;
transition: 0.3s;
}
.close:hover,
.close:focus {
color: #bbb;
text-decoration: none;
cursor: pointer;
}
@media only screen and (max-width: 700px){
.modal-content {
width: 100%;
}
}
<div id="myModal" class="modal">
<img class="modal-content" id="modalImage" src="someUrl">
<div class="top">
<div class="ico">
<span class="close">×</span>
</div>
</div>
<div id="caption">Lorem Ipsum</div>
</div>
编辑:自己解决。刚刚使用了边距:自动技巧。谢谢你随机投票。