亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

使用Google Font API

系統(tǒng) 2206 0

Google在5月20日宣布推出 Google Font Directory Google Font API 兩項服務(wù)。在Google Font Directory中,Google聯(lián)合了眾多的字體設(shè)計者為用戶提供了多種漂亮的字體,但現(xiàn)在全部是英文字體,相信今后會有中文字體。Google Font API 和Google Font Directory是相輔相成的,用戶正是通過Google Font API來使用Google Font Directory中的字體。

?

下面讓我們看看如何使用Google Font API 。

?

1.在 Google Font Directory查找字體

?

進(jìn)入 Google Font Directory 選擇合適的字體。 點擊選擇的字體可以查看它在各種大小下的顯示效果。

?

?

?

使用Google Font API


2.引用字體文件

?

由于這些字體在本地系統(tǒng)中不存在,所以必須在頁面中引用它們的字體文件。這些文件托管在Google的云中,引用它們通過下面的方式。

?

?

    <link  rel='stylesheet' type='text/css'>
  
?

3.使用字體

?

使用字體通過將html節(jié)點的font-family樣式設(shè)置為上面引用的字體。

?

?

    h1 { font-family: 'Reenie Beanie', arial, serif; }
  

?

?

給web頁面添加多個字體

如果你的頁面需要引用多個字體,則顯然使用自動生成的方法更簡單些,舉個例子,如下操作:

?

?

    <link  rel='stylesheet' type='text/css'>
  

?

?或

?

    @import url(http://fonts.googleapis.com/css?family=Parisienne|Glegoo|Asap:400,700italic,700,400italic|Condiment|Lilita+One|Kaushan+Script);
  

?

?

    <script type="text/javascript">
  WebFontConfig = {
    google: { families: [ 'Parisienne::latin', 'Glegoo::latin', 'Asap:400,700italic,700,400italic:latin', 'Condiment::latin', 'Lilita+One::latin', 'Kaushan+Script::latin' ] }
  };
  (function() {
    var wf = document.createElement('script');
    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
      '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
  })(); </script>
  
?

用法:

The Google Web Fonts API will generate the necessary browser-specific CSS to use the fonts. All you need to do is add the font name to your CSS styles. For example:

?

    font-family: 'Parisienne', cursive;
font-family: 'Glegoo', serif;
font-family: 'Asap', sans-serif;
font-family: 'Condiment', cursive;
font-family: 'Lilita One', cursive;
font-family: 'Kaushan Script', cursive;
  
?
    h1 { font-family: 'Metrophobic', Arial, serif; font-weight: 400; }
  
?

?

demo page:

?

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link id="fontLink"  rel='stylesheet' type='text/css'>
<style>#content{font-family:'Yanone Kaffeesatz';}</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$(function(){
	var eleLink = $("#fontLink");
	$("#select").bind("change", function() { 
		var href = eleLink.attr("href"), val = $(this).val();
		$("#content").css("fontFamily", val);
		if (!document.all) {
			eleLink.attr("href", href.split("=")[0] + "=" + val.replace(/\s/g, "+"));
		}
	});
})
</script>

<div id="content" class="show">
	<h3>展示</h3>
	<select id="select">
		<option value="Yanone Kaffeesatz">Yanone Kaffeesatz</option>
		<option value="Istok Web">Istok Web</option>
		<option value="Bowlby One">Bowlby One</option>
		<option value="Modern Antiqua">Modern Antiqua</option>
		<option value="Give You Glory">Give You Glory</option>
		<option value="Yeseva One">Yeseva One</option>
		<option value="Varela Round">Varela Round</option>
		<option value="Patrick Hand">Patrick Hand</option>
		<option value="Forum">Forum</option>
		<option value="Asap">Asap</option>
		<option value="Condiment">Condiment</option>
		<option value="Lilita One">Lilita One</option>
		<option value="Kaushan Script">Kaushan Script</option>
		<option value="Parisienne">Parisienne</option>
		<option value="Glegoo">Glegoo</option>
		<option value="Kotta One">Kotta One</option>
	</select>
	<p>Grumpy wizards make toxic brew for the evil Queen and Jack. One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked. One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked. </p>
</div>


  
?

?

?

?

?

使用Google Font API


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 四虎影视永久免费视频观看 | 天天夜夜骑 | 国产成人在线观看免费网站 | 久久国产精品免费 | 不卡影视 | 国产福利精品在线 | 久久99国产精品久久99小说 | 久久成人在线视频 | 欧美a级成人淫片免费看 | 欧美性猛交aa一级 | 日本特级 | 国产成人精品第一区二区 | 亚洲精品国产成人一区二区 | 91九色蝌蚪在线 | 在线亚洲欧美日韩 | 国内精品久久久久丫网址 | 亚洲一二区 | 欧美成人一区二区 | 国产精品h| 日本三级中文字幕 | 日本免费人成黄页网观看视频 | 毛片网站免费观看 | 日韩国产午夜一区二区三区 | 久久桃花网 | a级毛片在线视频免费观看 a级免费网站 | 99久久久国产精品免费播放器 | 色婷婷网| 大杳蕉伊人狼人久久一本线 | 免费看人做人爱视频拍拍拍 | 国产福利小视频在线观看 | 国产精品久久久久影院免费 | 麻豆国产精品高中生视频 | 一级毛片一级毛片 | 亚洲高清网站 | 成人久久网 | 澳门一级特黄录像免费播黄 | 亚洲日韩中文字幕在线播放 | 性欧美处| 国产真实乱子伦精品视 | aaa一区二区三区 | 国产精品合集久久久久青苹果 |