我有关于SweetAlert2的问题。
正如您在这张图片中看到的那样,这就是我的swal2的外观,但是在官方网站或其他网站上,文字更加流畅,我该如何解决?也许我忘记了一个CSS / JS?

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

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
    <script type="text/javascript" src="js/sweetalert2.js"></script>
</body>
</html>


截图:http://prntscr.com/jnoula
   Github / JSFiddle:http://prntscr.com/jnovyf

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

最佳答案

SweetAlert2没有定义字体系列,而是从文档继承它。原因是警报应与页面的其余部分保持一致。

为页面定义font-family,您会很好的:)

带有Ubuntu字体的演示:



swal({
  title: 'So beautiful yet terrific!',
  type: 'success'
})

body {
  font-family: 'Ubuntu';
}

<link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@7"></script> 

10-05 21:02
查看更多