使用 css 居中 sweetalert 文本

Center sweetalert text with css

我试图将文本居中放置在我的饮水盒中,但它不起作用:

CSS3:

.swal-modal {
    text-align: center;
}

JavaScript:

swal("myTitle", "some text \n some more text \n even more text);

您可以将自定义样式应用于默认的甜蜜提醒class

swal-text {
  text-align: center
}

您可以在 swal-modal

中使用 css 将文本居中
.swal-modal .swal-text {
    text-align: center;
}