Angularjs 屏幕中部的中心角度UI模式

Angularjs 屏幕中部的中心角度UI模式,angularjs,angular-ui-bootstrap,angular-ui,Angularjs,Angular Ui Bootstrap,Angular Ui,我遵循了从中获取的解决方案,但它不起作用。我需要把模态中心放在屏幕中间,水平和垂直。我试过了,但没用,有什么想法吗 Javascript var app = angular.module('app', ['ui.bootstrap']); app.controller('ctl', function ($scope,$uibModal) { $scope.modalInstance = $uibModal.open({ templateUrl: 'myModalCont

我遵循了从中获取的解决方案,但它不起作用。我需要把模态中心放在屏幕中间,水平和垂直。我试过了,但没用,有什么想法吗

Javascript

var app = angular.module('app', ['ui.bootstrap']);
app.controller('ctl', function ($scope,$uibModal) {

    $scope.modalInstance = $uibModal.open({
        templateUrl: 'myModalContent.html',
        windowClass: 'app-modal',
      }); 
});
HTML


.app modal.modal内容{
宽度:360px;
高度:200px;
}
标题
在css中的某些文本,请尝试以下操作:

.modal-dialog {
    position: absolute;
    top: 50%;
    /*half of the modal height*/
    margin-top: -100px;
    left: 50%;
    /*half of the modal width*/
    margin-left: -180px;
}
在css中,尝试以下操作:

.modal-dialog {
    position: absolute;
    top: 50%;
    /*half of the modal height*/
    margin-top: -100px;
    left: 50%;
    /*half of the modal width*/
    margin-left: -180px;
}

要使模式在引导中居中,可以使用
transform:translate(-50%,-50%)
位置组合:绝对属性

<style>
.modal-dialog {
  margin: 0;
  top: 50%;
  position: absolute;
  left: 50%;
  transform: translate(-50%,-50%);
}
</style>

.模态对话框{
保证金:0;
最高:50%;
位置:绝对位置;
左:50%;
转换:翻译(-50%,-50%);
}

不要忘记将边距归零
margin:0

要在引导中居中设置模式,可以使用
转换:translate(-50%,-50%)
位置组合:绝对属性

<style>
.modal-dialog {
  margin: 0;
  top: 50%;
  position: absolute;
  left: 50%;
  transform: translate(-50%,-50%);
}
</style>

.模态对话框{
保证金:0;
最高:50%;
位置:绝对位置;
左:50%;
转换:翻译(-50%,-50%);
}
不要忘记将边距归零
margin:0