Wechat: yu389741| Email: gisdqy@163.com

Shop:https://www.giserdqy.com/shop

bootstrap3 modal居中


modalcenter

bootstrap3 modal默认弹出位置居上,如何使弹出位置居中以及
bootstrap4如何设置modal居中呢 ,解决方案如下:

添加css样式

.modal-dialog-centered{
   position: absolute;
   left: 50%;
   /* now you must set a margin left under zero - value is a half width your window */
   margin-left: -312px;
   /* this same situation is with height - example */
   height: 500px;
   top: 50%;
   margin-top: -250px;
} 

modal-dialog追加class属性

bootstrap4已经支持此样式,直接添加modal-dialog-centered就可以,不需要手动写css

Have any Question or Comment?

发表评论

您的电子邮箱地址不会被公开。

CAPTCHAis initialing...