Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 显示类似于警报的网格_Html_Css_Ionic Framework_Ionic2 - Fatal编程技术网

Html 显示类似于警报的网格

Html 显示类似于警报的网格,html,css,ionic-framework,ionic2,Html,Css,Ionic Framework,Ionic2,我试图显示警报,但在那里我无法添加离子选择,所以我创建了一个网格,我需要在页面的中心显示该网格,背景应该被禁用 <ion-grid class="showmodal" *ngIf="showNews" style=" background:white; width:50%; height:60%"> <ion-row> </ion-row> </ion-grid> 即使屏幕大小不同,此网格也应始终位于中心。由于其高度和宽度是固

我试图显示警报,但在那里我无法添加离子选择,所以我创建了一个网格,我需要在页面的中心显示该网格,背景应该被禁用

<ion-grid  class="showmodal" *ngIf="showNews" style=" background:white; width:50%; height:60%">
    <ion-row>
    </ion-row>
</ion-grid> 

即使屏幕大小不同,此网格也应始终位于中心。

由于其高度和宽度是固定的,您可以将CSS用作:

 .showmodal {
    position: fixed;
    top: 50%;
    left: 50%;
    margin-left: auto;
    margin-right: auto;
    -webkit-transform: translateY(-50%);
    -moz-transform: translateY(-50%);
    transform: translateY(-50%);
}

添加父div并相应地添加样式

.showmodel{
高度:100px;
颜色:白色;
宽度:100px;
背景:钢蓝;
保证金:0自动;
利润率最高:15%;
}
.家长{
位置:固定;
排名:0;
z指数:10;
左:0px;
宽度:100%;
身高:100%;
背景:rgba(23,22,22,0.8);
}
内容
 .showmodal {
    position: fixed;
    top: 50%;
    left: 50%;
    margin-left: auto;
    margin-right: auto;
    -webkit-transform: translateY(-50%);
    -moz-transform: translateY(-50%);
    transform: translateY(-50%);
}