Google font - 如何指定font-family 如果他们有相同的名字?
Google font - how to specific font-family If they have the same name?
我尝试为我的 html 页面使用 Google 字体。
<link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
我希望字体系列的名称不同而不是相同
/* latin */
@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: 400;
src: local('Montserrat-Regular'), url (http://fonts.gstatic.com/s/montserrat/v6/zhcz-_WihjSQC0oHJ9TCYPk_vArhqVIZ0nv9q090hN8.woff2) format('woff2');
unicode-range: ..
}
/* latin */
@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: 700;
src: local('Montserrat-Bold'), url (http://fonts.gstatic.com/s/montserrat/v6/IQHow_FEYlDC4Gzy_m8fcoWiMMZ7xLd792ULpGE4W_Y.woff2) format('woff2');
unicode-range: ..
}
我尝试这样做但没有成功。
.one {
font-family: 'Montserrat';
font-size: 11px;
font-weight: 700;
}
two {
font-family: 'Montserrat';
font-size: 11px;
font-weight: 400;
}
如何在 css 中定义两种不同的字体?
谢谢
这行得通,但是您漏掉了 CSS 上 two
前面的点 (.
)。请参阅以下代码段:
.one {
font-family: 'Montserrat';
font-size: 11px;
font-weight: 700;
}
.two {
font-family: 'Montserrat';
font-size: 11px;
font-weight: 400;
}
<link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<span class="one">This is text on "one" with weight 700</span><br/>
<span class="two">This is text on "two" with weight 400</span>
我尝试为我的 html 页面使用 Google 字体。
<link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
我希望字体系列的名称不同而不是相同
/* latin */
@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: 400;
src: local('Montserrat-Regular'), url (http://fonts.gstatic.com/s/montserrat/v6/zhcz-_WihjSQC0oHJ9TCYPk_vArhqVIZ0nv9q090hN8.woff2) format('woff2');
unicode-range: ..
}
/* latin */
@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: 700;
src: local('Montserrat-Bold'), url (http://fonts.gstatic.com/s/montserrat/v6/IQHow_FEYlDC4Gzy_m8fcoWiMMZ7xLd792ULpGE4W_Y.woff2) format('woff2');
unicode-range: ..
}
我尝试这样做但没有成功。
.one {
font-family: 'Montserrat';
font-size: 11px;
font-weight: 700;
}
two {
font-family: 'Montserrat';
font-size: 11px;
font-weight: 400;
}
如何在 css 中定义两种不同的字体? 谢谢
这行得通,但是您漏掉了 CSS 上 two
前面的点 (.
)。请参阅以下代码段:
.one {
font-family: 'Montserrat';
font-size: 11px;
font-weight: 700;
}
.two {
font-family: 'Montserrat';
font-size: 11px;
font-weight: 400;
}
<link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<span class="one">This is text on "one" with weight 700</span><br/>
<span class="two">This is text on "two" with weight 400</span>