Sass - 使用 Material Web 组件设置字体系列 [英] Sass - Setting the font family with material web components

查看:52
本文介绍了Sass - 使用 Material Web 组件设置字体系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用 Material Web 组件,我想更改字体系列.我正在浏览他们的文档我试图通过在我的 sass 文件中设置变量来做到这一点:

I am using material web components in my project and I would like to change the font family. I was going through their documentation and I have tried to do that by setting the variable in my sass file like this:

$mdc-typography-font-family: Comfortaa, sans-serif !default;

但是,这不起作用,在文档中它还说 sass mixin 设置了字体:

But, that didn't work, in the documentation it also says that sass mixin sets the font:

mdc-typography-base 

如何更改 mixin 以使用不同的字体系列?

How can I change the mixin to use a different font-family?

推荐答案

我通过删除 !default 标志来解决这个问题:

I figured this out by removing !default flag:

$mdc-typography-font-family: Comfortaa, sans-serif;

另外,不要忘记在 head 标签中嵌入 Google 字体:

Also, don't forget to embed Google Fonts in the head tag:

<link href="https://fonts.googleapis.com/css?family=Comfortaa" rel="stylesheet">

这篇关于Sass - 使用 Material Web 组件设置字体系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆