我正在使用通用聚合物2.0登录页面应用程序,并试图为标题栏使用自定义字体。如何在聚合物中使用自定义字体
在我登录-page.html中,我有这样的自定义样式:
<custom-style>
<style is="custom-style">
body {
margin: 0;
}
app-toolbar {
background-color: #4F1585;
font-family: 'Roboto', Helvetica, sans-serif;
color: white;
--app-toolbar-font-size: 24px;
}
#maintitle{
color: red;
font-family: 'font-regular';
}
</style>
</custom-style>
我的头/工具栏:
<app-header fixed condenses effects="waterfall">
<app-toolbar>
<img src="../icons/app-icon.png" style="height:100%;"/>
<div main-title id="maintitle">Login Page</div>
</app-toolbar>
</app-header>
我导入TTF文件是这样的:
<link rel="stylesheet" href="../fonts/font-regular.ttf" type="css">
该代码将文本变为红色,但不适用字体。相反,它会切换到Times new roman。我是聚合物品牌的新手,有什么我失踪的?
嗯,在我的代码中,我是这样做的:'@import url('https://fonts.googleapis.com/css?family=Montserrat:300,500,700');'但我不擅长这一点,而我让别人来回答。在你的情况下,你应该propably遵循这个:http://stackoverflow.com/questions/7961721/how-do-i-install-a-custom-font-on-an-html-site –
@KubaŠimonovský我已经遵循这个答案,但它没有奏效..我会等待更多的回应! – RandomStranger