gpt4 book ai didi

html - Muli 字体无法正确呈现

转载 作者:太空宇宙 更新时间:2023-11-04 00:41:23 25 4
gpt4 key购买 nike

我在 html 和 wkhtmltopdf 中正确呈现字体时遇到问题。我在整个正文中使用了 Muli 字体(从 Google 下载:https://fonts.google.com/specimen/Muli ),但有些部分被切掉了(下图,零没有很好地四舍五入)。我没有看到与 RobotoMontserrat 相同的效果。这是我的代码:

<html>
<head>
<style>
body {
font-family: 'Muli', sans-serif;
}
.thin {
font-weight: 200;
}
.light {
font-weight: 300;
}
.regular {
font-weight: 400;
}
.bold {
font-weight: 600;
}
.extraBold {
font-weight: 700;
}
.black {
font-weight: 800;
}
.extraBlack {
font-weight: 900;
}
</style>
</head>

wkhtmltopdf -L 0 -R 0 -T 0 -B 0 --page-width 2933px --page-height 5194px --disable-smart-shrinking

enter image description here

最佳答案

您可以使用此代码

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>Hello, world!</title>
<link href="https://fonts.googleapis.com/css?family=Muli&display=swap" rel="stylesheet">
<style type="text/css">
@import url('https://fonts.googleapis.com/css?family=Muli&display=swap');
body {
font-family: 'Muli', sans-serif;
}
h1 {
font-size: 110px;
font-weight: 900;
color: #00b3b8;
}
h2 {
font-size: 110px;
font-weight: 700;
color: #001fb8;
}
h3 {
font-size: 110px;
font-weight: 600;
color: #b88800;
}
h4 {
font-size: 110px;
font-weight: 400;
color: #b82a00;
}
h5 {
font-size: 110px;
font-weight: 300;
color: #ad00b8;
}
h6 {
font-size: 110px;
font-weight: 200;
color: #000000;
}
</style>
</head>
<body>
<h1>100</h1>
<h2>200</h2>
<h3>300</h3>
<h4>400</h4>
<h5>500</h5>
<h6>600</h6>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>

关于html - Muli 字体无法正确呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58238591/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com