meta便签的用法

1.定义编码规则,<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

 

2.Refresh (刷新)

让网页多长时间(秒)刷新自己,或在多长时间后让网页自动链接到其它网页。<Meta http-equiv=Refresh Content=30><Meta http-equiv=Refresh Content=5; Url=http://www.xxx.com>注意:其中的5是指停留5秒钟后自动刷新到URL网址。

 

3.Expires (期限)

说明:指定网页在缓存中的过期时间,一旦网页过期,必须到服务器上重新调阅。

用法:<Meta http-equiv=Expires Content=0>

<Meta http-equiv=Expires Content=Wed, 26 Feb 1998 09:21:57 GMT>

注意:必须使用GMT的时间格式,或直接设为0(数字表示多少时间后过期)

 

4.Wap网站不进行缩放

<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />

 

5.指定是否将网页内容中的手机号码显示为拨号的超链接

<meta name="format-detection" content="telephone=no/yes">(no为不显示,yes为显示。)

 

6.name属性

name属性主要用于描述网页,与之对应的属性值为content,content中的内容主要是便于搜索引擎机器人查找信息和分类信息用的。

 meat标签的name属性语法格式是:<meta name="参数" content="具体的参数值"> 。

 其中name属性主要有以下几种参数:

 A、Keywords(关键字)

 说明:keywords用来告诉搜索引擎你网页的关键字是什么。

 举例:<meta name ="keywords" content="science, education,culture,politics,ecnomics,relationships, entertaiment, human">

 B、description(网站内容描述)

 说明:description用来告诉搜索引擎你的网站主要内容。

 举例:<meta name="description" content="This page is about the meaning of science, education,culture.">

 C、robots(机器人向导)

 说明:robots用来告诉搜索机器人哪些页面需要索引,哪些页面不需要索引。

 content的参数有all,none,index,noindex,follow,nofollow。默认是all。

 举例:<meta name="robots" content="none">

 D、author(作者)

 说明:标注网页的作者

 举例:<meta name="author" content="123@21cn.com">

7.实现网页转换时的动画效果

<meta http-equiv="Page-Enter" content="revealTrans(duration=5.0, transition=20)">
<meta http-equiv="Page-Exit" content="revealTrans(duration=5.0, transition=20)">

一旦上述代码被加到一个网页中后,我们再进出页面时就会看到一些特殊效果,这个功能其实与FrontPage2000中的Format/Page Transition一样,但我们要注意的是所加网页不能是一个Frame页;

8.控制页面缓冲

meta标签可以设置网页到期的时间,也就是说,当你在Internet Explorer 浏览器中设置浏览网页时首先查看本地缓冲里的页面,那么当浏览某一网页,而本地缓冲又有时,那么浏览器会自动浏览缓冲区里的页面,直到meta中设置的时 间到期,这时候,浏览器才会去取得新页面。例如下面这段代码就表示网页的到期时间是2001年1月12日18时18分18秒。

〈meta http-equiv=″expires″ content=″Friday, 12-Jan-2001 18:18:18 GMT″〉

9.控制网页显示的窗口

我们还可以使用meta标签来控制网页显示的窗口,只要在网页中加入下面的代码就可以了:<metahttp-equiv="window-target" content="_top">,这段代码可以防止网页被别人作为一个Frame调用

posted @ 2015-05-11 15:25  修路  阅读(290)  评论(0编辑  收藏  举报