Skip to content

SweetAlert2 crappy text

I have a question about SweetAlert2. As you can see in this picture that’s how my swal2 looks, but on the official site or others the text is smoother, how should I fix this? Maybe I’ve forgot one CSS/JS?

<!DOCTYPE html>
    <title> test </title>
    <link rel="stylesheet" type="text/css" href="css/sweetalert2.css">
function myFn(){
  'Mesajul a fost trimis cu succes!',

    <script src=""></script>
    <script type="text/javascript" src="js/sweetalert2.js"></script>

Screenshot: Github / JSFiddle:

 <?php echo '<script type="text/javascript">
                </script>'; ?>



SweetAlert2 doesn’t define font-family but inherits it from the document. The reason is that alerts should look consistent with the rest of the page.

Define the font-family for your page and you’ll be fine 🙂

Demo with Ubuntu typeface:{
  title: 'So beautiful yet terrific!',
  icon: 'success'
body {
  font-family: 'Ubuntu';
<link href="" rel="stylesheet">
<script src=""></script> 
User contributions licensed under: CC BY-SA
7 People found this is helpful