1

在 Figma 中,我有一个显示以下代码的文本设计:

/* Create Account */


position: absolute;
width: 343px;
height: 142px;
left: 575px;
top: 272px;

font-family: Montserrat;
font-style: normal;
font-weight: bold;
font-size: 30px;
line-height: 37px;
display: flex;
align-items: center;
text-align: center;

color: rgba(255, 255, 255, 0.92);

但是,当我在 html 中有以下代码时(文本具有与 Figma 指示的字体相同的字体,文本的字体在 html/css 中与在 figma 中的显示不同,如我附上的两张图片所示(请忽略不同的背景):

<!DOCTYPE html>
<html lang="en">

<head>

</head>

<body style="margin: 0 auto;text-align:center;background: #141E30;  /* fallback for old browsers */ background: -webkit-linear-gradient(to bottom, #243B55, #141E30);  /* Chrome 10-25, Safari 5.1-6 */ background: linear-gradient(to bottom, #243B55, #141E30); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */;">

    <p style="font-family: Montserrat; font-style: normal; font-weight: bold; color: rgba(255, 255, 255, 0.92);font-size: 30px;">Create Account</p>

</body>

</html>

有谁知道为什么我不能在 html/css 中重新创建完全相同的字体外观?

Figma 设计: Figma 外观 HTML/CSS: HTML/CSS 外观

4

1 回答 1

2

添加 HTML 头部:

<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;600;700;800&display=swap" rel="stylesheet">

添加CSS:

font-family: 'Montserrat', sans-serif;
于 2020-06-24T08:01:45.233 回答