неправильный формат текста из-за отображения в html/css из фигмы
В 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?
1 ответ
Решение
Добавьте в заголовок 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;