我在设计中使用了SourceSansPro来匹配字体,FF,Safari似乎还可以。Chrome和IE 11有问题。
这是字体的设计(由于代理,不能上传,但可以看看FF和Safari)
下面是代码:
<html>
<head>
<link
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro"
rel="stylesheet"
type="text/css"
/>
<style>
.fontStyle {
font-style: normal;
font-size: 16px;
font-family: "SourceSansPro", Helvetica, Arial, sans-serif;
color: #000;
font-weight: 500;
}
</style>
</head>
<div class="fontStyle">
Drop a file here
</div>
</html>IE和Chrome中的粗体似乎有很大的不同。总而言之,需要在IE和Chrome中制作字体样式,与FF和Safari相同。
发布于 2019-09-23 21:59:59
默认情况下,你使用的代码只包含400磅的字体,当浏览器尝试获取更轻字体的粗体版本时,浏览器会有不同的反应-有些浏览器会自己加粗,或者只是加载不同的字体。为了加载您想要的字体粗细(以及斜体版本),您可以使用如下代码行:
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,200i,300,300i,400,400i,600,600i,700,700i,900,900i&display=swap" rel="stylesheet">使用逗号分隔版本/权重。
如果您转到Google Font page for this,您可以单击“自定义”选择要包含的字体,它将为您生成嵌入代码。
发布于 2019-09-23 13:41:41
您可以使用以下代码
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap" rel="stylesheet" type="text/css" />
<style>
.fontStyle {
font-style: normal;
font-size: 16px;
font-family: 'Source Sans Pro', sans-serif;
color: #000;
font-weight: 500;
}
</style>
</head>
<div class="fontStyle">
Drop a file here
</div>
</html>
https://stackoverflow.com/questions/58054437
复制相似问题