網(wǎng)站的設(shè)計已經(jīng)越來越偏向個性化了,大家都在想方設(shè)法的實現(xiàn)獨(dú)特的網(wǎng)站風(fēng)格,嵌入字體/網(wǎng)絡(luò)字體是達(dá)到這一目標(biāo)的方法之一。而之前,我們在《如何在網(wǎng)頁設(shè)計中使用個性化字體》中有介紹過typeface.js,它可以很方便的將個性字體嵌入到網(wǎng)頁中,并且具有良好的兼容性,從而可以彌補(bǔ)@font-face的不足。但是typeface有個不足——使用typeface的字體不能被選中,這顯然會影響網(wǎng)站的用戶體驗。
現(xiàn)在好了,已經(jīng)出來了一個非官方的解決方案:type select。
typeselect事實上是定制了typeface的某些方法,但同時需要jquery庫的支持,用法和typeface是一樣的:
在頁面的頭部加載以下js文件:
<link rel="stylesheet" type="text/css" href="css/typeselect.css"/><script type="text/javascript" src="js/typeface-custom.js"></script><script type="text/javascript" src="fonts/nilland_regular.typeface.js"></script><script type="text/javascript" src="js/jquery-1.3.2.min.js"></script><script type="text/javascript" src="js/typeselect.js"></script>
然后在頁面或css中定義你要嵌入的字體名稱:
html中:
<h1 class="select" style="font-family: 'linux libertine', georgia, serif; ">your text</h1>
css中:
h1 {font-size: 55px; font-family: nilland, times; font-weight: normal; font-style: normal;}
請注意以下事項:
欲了解更多,請到這里下載一個演示包,或者到官方網(wǎng)站查看更多信息。
新聞熱點
疑難解答