可以将字体文件放在工程rawfile目录下,在H5代码中使用@font-face指定用于显示文本的自定义字体,在指定元素中配置font-family属性设置自定义字体。 示例代码:webFixedFont<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Document</title> <style> @font-face { font-family: 'MaoKenWangXingYuan'; src: url('./MaoKenWangXingYuan.ttf'); } #title { font-family: 'MaoKenWangXingYuan'; } </style> </head> <body> <h1 id="title">猫啃忘形圆</h1> </body> </html>
可以将字体文件放在工程rawfile目录下,在H5代码中使用@font-face指定用于显示文本的自定义字体,在指定元素中配置font-family属性设置自定义字体。 示例代码: