我在ajax模态扩展器中有一个图像。在gridview中单击按钮时显示成功,但默认情况下图像滚动到页面的右下角,当我按下键盘上的箭头时,它只会到达中心。为什么?如何将其置于中心默认?
<style type="text/css">
.modalBackground {
background-color: Black;
filter: alpha(opacity=90);
opacity: 0.8;
}
.modalPopup {
background-color: whitesmoke;
border-width: 0px;
border-style: solid;
border-color: black;
padding-top: 10px;
padding-left: 10px;
padding-right: 10px;
/*width: 600px;
height: 280px;*/
}
</style>
CSS
parentPanel
答案 0 :(得分:4)
为.modalPopup
添加以下内容:
.modalPopup {
background-color: whitesmoke;
border-width: 0px;
border-style: solid;
border-color: black;
padding-top: 10px;
padding-left: 10px;
padding-right: 10px;
/* Additions */
position: absolute;
left: 25%;
right: 25%;
top: 25%;
bottom: 25%;
}
答案 1 :(得分:0)
使用flex layout
尝试此操作 .modalBackground {
background-color: Black;
filter: alpha(opacity=90);
opacity: 0.8;
display: flex;
align-items: center;
justify-content: center;
}
.modalPopup{padding: 10px; max-width: 360px;}