美文网首页
.el-dialog弹窗垂直居中(重点::兼容IE)

.el-dialog弹窗垂直居中(重点::兼容IE)

作者: 小李不小 | 来源:发表于2021-08-16 15:03 被阅读0次

引人el-dialog显示是不垂直居中的。

image.png

遇到这问题,我们应该怎么来解决呢。

新建一个style 不加scope 就可以

<template>
<el-dialog
  title="提示"
  :visible.sync="centerDialogVisible"
  width="30%"
  center
  >
 
  <span>需要注意的是内容是默认不居中的</span>

</el-dialog>

</template>

<Script>
data(){
retunr{
centerDialogVisible:true,
}
}
</Script>

<style>



.el-dialog{
    display: flex;
    display: -ms-flex; /* 兼容IE */
    flex-direction: column;
    -ms-flex-direction: column; /* 兼容IE */
    margin:0 !important;
    position:absolute;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    max-height:calc(100% - 30px);
    max-width:calc(100% - 30px);
  }
.el-dialog .el-dialog__body{
    max-height: 100%;
    flex: 1;
    -ms-flex: 1 1 auto; /* 兼容IE */
    overflow-y: auto;
    overflow-x: hidden;
}

.el-dialog__wrapper {
    /*隐藏ie和edge中遮罩的滚动条*/
    overflow: hidden;
}
</style>
看效果图,完美解决了
image.png

相关文章

  • .el-dialog弹窗垂直居中(重点::兼容IE)

    引人el-dialog显示是不垂直居中的。 遇到这问题,我们应该怎么来解决呢。 新建一个style 不加scope...

  • css垂直居中方法整理

    行高+padding垂直居中法(兼容性好IE5.5及以上) table垂直居中法(兼容性好IE5.5及以上) 垂直...

  • css文字垂直居中

    1、确定高度单行垂直居中 2、确定高度多行文本垂直居中 translate(兼容ie9以上浏览器,包含ie9;此方...

  • 水平垂直居中 兼容 IE

    利用table特性,模拟水平垂直居中 查看在线demo[http://jsrun.net/PUwKp] 利用伪元素...

  • 小知识

    selcet框内的文字垂直居中,兼容ie8 在对 标签进行一些样式设计的同时,会要求选择框内的文字是垂直居中的,之...

  • div垂直居中的几种方法

    1.div绝对定位水平垂直居中【margin:auto实现绝对定位元素的居中】 兼容性:,IE7及之前版本不支持 ...

  • 前端 & 小测

    点亮星星 文本打点-单行 用户体验&实现 文字垂直居中 CSS-宽高定比例展示 【IE】CSS版本兼容&JS检测 ...

  • 【css图片垂直居中】让html img图片垂直居中的三种方法

    一、使用flex实现垂直居中 利用css flex实现垂直居中。flex可能不是实现垂直居中最好的选择,因为IE8...

  • LayaBox:富文本HtmlDivElement垂直水平居中

    注意:目前不支持文本的垂直居中对齐 示例:文本垂直水平居中(文本的垂直居中使用padding替代设置) 重点解析:...

  • 垂直居中

    不管是前端面试题,还是实际开发中,经常遇到使模块垂直居中的需求。 PC端: 1、基于 绝对定位 兼容性好,IE6+...

网友评论

      本文标题:.el-dialog弹窗垂直居中(重点::兼容IE)

      本文链接:https://www.haomeiwen.com/subject/etkdzktx.html