简体   繁体   English

设置CSS字体的样式以在html页面上具有两种自定义字体

[英]Styling a CSS font face to have two custom fonts on a html page

I have a web page that successfully uses one of the two font-faces I have here. 我有一个网页,该网页成功使用了我在此处使用的两个字体之一。 I want the user to be able to see a top menu div tag that is styled with the Cubano font while the rest of the text of the page will be open sans. 我希望用户能够看到以Cubano字体设置样式的顶部菜单div标签,而页面的其余文本将保持打开状态。 @font-face seems to be just unique so I cant add two font-familys to it. @ font-face似乎是唯一的,所以我不能在其中添加两个字体家族。

EDIT: Demo can be seen here on the rate1.html page. 编辑:演示可以在这里在rate1.html页面上看到。

@font-face {
font-family: 'OpenSans';
src: url("fonts/opensans.ttf") format('truetype');
font-weight: normal;
font-style: normal
}

@font-face {
font-family: 'Cubano';
src: url("fonts/cubano-webfont.ttf") format('truetype');
font-weight: normal;
font-style: normal
}


body {
font: 32px/40px 'OpenSans', sans-serif;
color: #777;
}

body div.recent {
font: 32px/40px 'Cubano', sans-serif;
color: #777999;
}

For the Open Sans you can use @import (in .css file): 对于Open Sans,您可以使用@import(在.css文件中):

@import url(https://fonts.googleapis.com/css?family=Open+Sans);

or link it in the <head> : 或将其链接到<head>

<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>

See more options here 在这里查看更多选项

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM