我有一个关于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>'; ?>发布于 2018-05-28 18:52:37
SweetAlert2没有定义字体系列,但是从文档继承它。原因是警报应该看起来与页面的其余部分一致。
为您的页面定义font-family,您会很好:)
Ubuntu字体演示:
Swal.fire({
title: 'So beautiful yet terrific!',
icon: 'success'
})body {
font-family: 'Ubuntu';
}<link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
https://stackoverflow.com/questions/50570897
复制相似问题