如何更改 sweetalert 的字体系列

新手上路,请多包涵

如何更改 sweetalert 中的字体系列?谢谢你

swal({
            title: "Are you sure?",
            text: "Your will not be able to recover this imaginary file!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes, delete it!",
            cancelButtonText: "No, cancel plx!",
            closeOnConfirm: false,
            closeOnCancel: false
        },

原文由 farshid azizi 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 903
2 个回答

将此添加到 css!

 .swal2-popup {
  font-size: 1.6rem !important;
  font-family: Georgia, serif;
}

原文由 Arun P 发布,翻译遵循 CC BY-SA 4.0 许可协议

此处 列出了配置选项。它们似乎不包含更改字体的选项。

但是,SweetAlert 弹出窗口中涉及的所有元素都具有特定于 SweetAlert 的类,因此您应该能够通过 CSS 设置字体。 SweetAlert 文档中 Theming 下列出了一些关键类和示例。

原文由 Ouroborus 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题