css - 字体粗细在CSS中没有改变

标签 css styles stylesheet webfonts google-webfonts

使用谷歌网络字体,我无法获得字体粗细来产生结果。这三个权重确实有名称,但没有在 href 链接中指定,所以我不确定是否需要添加名称。

这是那部分代码:

<link href='http://fonts.googleapis.com/css?family=Quicksand:400,300,700' rel='stylesheet' type='text/css'><style type="text/css">
    body{
        background-color: white;
        margin-left: 20%;
        margin-right: 20%;
        border: none;
        padding: 10px 10px 10px 10px;
        font-family: Quicksand, sans-serif;
        font-weight: 300;
    }

最佳答案

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500&display=swap" rel="stylesheet">

:- 在链接任何类型的外部字体之前使用预连接关系,现在它可以工作,如果有任何问题然后告诉我

关于css - 字体粗细在CSS中没有改变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16072265/

相关文章:

javascript - 内容样式表?

CSS 绝对定位和响应式设计

css - 为什么正文背景图片覆盖了 HTML 标签背景?

html - 如何修复图像上的透明菜单?

WPF创建样式而不覆盖默认样式

c# - Xamarin Forms 为 Android 带来光明

css - Dojo - 在 domConstruct.create() 中提供多个类名

c++ - Qt : How to make a dynamically added item not comply to style sheet set at design time

html - 在 HTML 文档中包含不同的字体

javascript - 如何使用javascript获取访问链接的CSS样式