自定義字體 | 您所在的位置:網(wǎng)站首頁 › 屬兔的和屬馬的婚配嗎 › 自定義字體 |
# 自定義字體 主題使用了以下五個(gè) CSS Variablesopen in new window 來定義字體: :root{ --sys-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Droid Sans", "Helvetica Neue"; --zh-font-family: "PingFang SC", "Hiragino Sans GB", "Droid Sans Fallback", "Microsoft YaHei"; --base-font-family: "Lato", var(--sys-font-family), var(--zh-font-family); --code-font-family: Menlo, Monaco, Consolas, "Courier New"; --article-font-family: var(--base-font-family); } 123456789默認(rèn)加載open in new window了 Lato 這個(gè)英文字體。中文字體的定義在 --zh-font-family 這個(gè)變量里。 可以在頁面頭部 / 底部插入 標(biāo)簽來覆蓋這些變量,參考「修改主題open in new window」 # 例子:給文章加上思源宋體我博客文章使用的是思源宋體open in new window(沒有內(nèi)置在主題里)。 在站點(diǎn)根目錄新建文件 layouts/partials/head/custom.html, 內(nèi)容如下: :root { --article-font-family: "Noto Serif SC", var(--base-font-family); } (function () { const customFont = document.createElement('link'); customFont.; customFont.type = "text/css"; customFont.rel = "stylesheet"; document.head.appendChild(customFont); }()); 1234567891011121314151617 Edit this page open in new windowLast Updated: Contributors: Jimmy, Jimmy Cai |
今日新聞 |
推薦新聞 |
專題文章 |
CopyRight 2018-2019 實(shí)驗(yàn)室設(shè)備網(wǎng) 版權(quán)所有 |