为什么弹出窗口出现在底部而不是位于中心?

时间:2016-01-24 19:23:33

标签: javascript css asp.net asp.net-ajax modalpopupextender

我在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

enter image description here

2 个答案:

答案 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;}
相关问题