how to change font family of sweetalert
22,298
Solution 1
Configuration options are listed here. They do not appear to include an option for changing the font.
However, all of the elements involved in the SweetAlert popup have SweetAlert-specific classes so you should be able to set the fonts via CSS. Some key classes and examples are listed in the SweetAlert docs under Theming.
Solution 2
Add this to the css!
.swal2-popup {
font-size: 1.6rem !important;
font-family: Georgia, serif;
}
Related videos on Youtube
![farshid azizi](https://lh4.googleusercontent.com/-4TnJRzxRm9c/AAAAAAAAAAI/AAAAAAAAAAA/ACevoQM99thIKjMggaMxdmogEa6nJFLGrA/mo/photo.jpg?sz=256)
Author by
farshid azizi
Updated on June 09, 2021Comments
-
farshid azizi about 3 years
How can I change the font family in sweetalert? Thank You
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 },
-
Rory McCrossan almost 5 yearsChange the CSS rule for the alert.
-
-
Bishwas about 3 yearsThe user is asking about the font family. Not font size.
-
Arun P about 3 yearsI have updated the answer, its just to add the style for the same class