gpt4 book ai didi

html - CSS:2 种厚度 - 1 种字体

转载 作者:行者123 更新时间:2023-11-28 04:54:06 25 4
gpt4 key购买 nike

我使用 Google Roboto Font在我的网站上,但我有一个小实现问题。 Google 允许我们在导入前调整字体粗细:

粗细为700的字体导入代码

@import url('https://fonts.googleapis.com/css?family=Roboto:700');

粗细为300的字体导入代码

@import url('https://fonts.googleapis.com/css?family=Roboto:300');

我的问题是,CSS 中的用法不依赖于两个导入。这意味着它总是

font-family: 'Roboto', sans-serif;

而且我无法选择要使用的 2 种导入字体中的哪一种。

最佳答案

在 CSS 方面,您必须分别应用这些规则:

font: normal 300 16px 'Roboto', sans-serif; //thin font
font: normal 700 16px 'Roboto', sans-serif; //bolder font

关于html - CSS:2 种厚度 - 1 种字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40515940/

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