網站最佳化之字型

來源:互聯網
上載者:User

標籤:nio   font-face   ceo   處理   div   mbed   gbk   服務   firefox   

首先,處理字型,在網頁:https://www.fontsquirrel.com

目前,@ font-face的支援

  • Firefox
  • Opera
  • Chrome
  • Safari
  • Internet Explorer 9

在舊的瀏覽器使用@ font-face時,不同的瀏覽器支援特定的字型檔。

  • IE瀏覽器:EOT
  • Mozilla瀏覽器:OTF,TTF
  • Safari瀏覽器:OTF,TTF??,SVG
  • 歌劇:OTF,TTF??,SVG
  • Chrome瀏覽器:TTF,SVG

將其分別轉成.eot  .woff  .ttf  .svg  ,然後利用@font-face

@font-face {
font-family:‘fangZheng‘;
src:url(‘../fontface/fangZheng/_gbk_m-webfont.eot‘);
src:url(‘../fontface/fangZheng/_gbk_m-webfont.eot‘) format(‘embedded-opentype‘), /* IE6-IE8 */url(‘//at.alicdn.com/t/font_1474877045_270467.eot?#iefix‘) format(‘embedded-opentype‘), /* IE6-IE8 */url(‘../fontface/fangZheng/_gbk_m-webfont.woff‘) format(‘woff‘) /* chrome、firefox */,url(‘../fontface/fangZheng/_gbk_m-webfont.svg‘) format(‘svg‘);
}
//使用的時候
.banner-text>p{font-family:‘fangZheng‘;}

拓展:

-使用Font Family Reunion這樣的服務,選擇一個可備用的字型,以免字型未載入完或載入失敗,而出現的空白。

-Font Face Observer, 壓縮後大小4KB,這塊也不熟https://github.com/bramstein/fontfaceobserver
-字型載入器——Font Loading polyfill,這塊還不熟。https://github.com/bramstein/fontloader
參考:http://www.w3cplus.com/css3/the-font-face-dilemma.html

網站最佳化之字型

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.