【发布时间】:2022-01-26 22:39:31
【问题描述】:
我正面临 css 字体粗细问题。我有一个网站,我想减少字体重量,但即使是最轻的重量(即 100 看起来像这样),它似乎也是固定的。
但我希望它看起来像这样 我使用的字体是 Merriweather-Sans
我的 css 文件 1,其中包含与正文和标题相关的 css:
body {
font-size: $font-size-base;
line-height: line-height($font-size-base);
color: $color-black;
}
h1 {
font-size: $font-size-h1;
line-height: line-height($font-size-h1);
margin-bottom: $spacer;
font-weight: 100;
color: $color-slate;
}
h2 {
font-size: $font-size-h2;
line-height: line-height($font-size-h2);
font-weight: $font-weight-light;
color: $color-crimson;
margin-bottom: $spacer;
color: $color-slate;
text-transform: capitalize;
}
h3 {
font-size: $font-size-h3;
line-height: line-height($font-size-h3);
font-weight: $font-weight-normal;
margin-bottom: $spacer;
color: $color-slate;
}
h4 {
font-size: $font-size-h4;
line-height: line-height($font-size-h4);
margin-bottom: $spacer;
}
p {
font-size: $font-size-base;
line-height: line-height($font-size-base);
margin-bottom: $spacer;
color: $color-slate;
}
我的 css 文件 2 包含上面在 css 中声明的变量:
/* === Typography === */
@import url('https://fonts.googleapis.com/css?family=Merriweather+Sans');
$font-family-base: 'Merriweather Sans', sans-serif;
$font-size-base: 1rem;
$font-size-h1: $font-size-base * 3;
$font-size-h2: $font-size-base * 2;
$font-size-h3: $font-size-base * 1.75;
$font-size-h4: $font-size-base * 1.25;
$font-size-lead: $font-size-base * 1.25;
$font-size-small: $font-size-base * 0.875;
$font-weight-light: 200;
$font-weight-normal: 400;
$font-weight-bold: 700;
/* === Line height === */
$line-height-list: 1.5rem;
【问题讨论】:
-
您能否在您的问题中加入一个小的工作 sn-p,因为我难以重现您的问题。请参阅 stackoverflow.com/help/minimal-reproducible-example 以获取有关此操作的帮助。
-
我明白了吗?为什么要使用 两个 CSS 文件?
-
this import 'fonts.googleapis.com/css2?family=Merriweather+Sans' 只包含 font-weight 400,我想这就是原因
-
@Andara 这种字体有什么替代品吗?我们可以使用 font-weight 100?