在项目的公用模板里css自定义字体并使用

在项目的公用模板里css自定义字体并使用

// 文件路径 public/index.html
// 必须要先有字体文件, 比如 *.ttf文件, UI提供或网上下载
<style>
	//引入字体文件并命名
  @font-face {
    font-family: 'custom-font';   /*字体名称-随意*/
    src: url('你自己的字体文件路径.ttf') format('truetype');       /*字体源文件*/
  }
  // 使用方法
  .custom-font {
    font-family: "custom-font" !important;
    font-size: 16px;
    font-style: normal;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
</style>
// 使用
.classNameDemo{
	font-family: "custom-font";
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章