请问HTML 中的 <meta> 标签是干什么用的?

meta标签是html语言head区的一个辅助性标签

meta通常用来为搜索引擎定义页面的主题,或为用户的浏览器设置cookie, 用于鉴别作者设置页面格式等

meta 标签分为两个部分:http标题信息(http-equiv)页面描述信息(name)

http-equiv

http-equiv类似http的协议头,它回应给浏览器一些有用的信息,以帮助浏览器正确和精确的显示网页内容

如 content-Type content-Language  refresh(多久刷新) Expires Pragma(禁止浏览器从本地机的缓存中调阅页面内容)

Set-Cookie (cookie设定)

<Meta http-equiv="Content-Type" Content="text/html; Charset=gb2312">

<Meta http-equiv="Content-Language" Content="zh-CN">

<Meta http-equiv="Refresh" Content="5; Url=http://www.xia8.net"> // 其中的5是指停留5秒钟后自动刷新到URL网址

<Meta http-equiv="Expires" Content="Wed, 26 Feb 1997 08:21:57 GMT"> //必须使用GMT的时间格式,或直接设为0(数字表示多少时间后过期)。

<Meta http-equiv="Set-Cookie" Content="cookievalue=xxx; expires=Wednesday,

21-Oct-98 16:14:21 GMT; path=/">

 

Window-target (显示窗口的设定) 强制页面在当前窗口以独立页面显示

<Meta http-equiv="Widow-target" Content="_top">

 这个属性是用来防止别人在框架里调用你的页面。Content选项:_blank、_top、_self、_parent.

Page-Enter、Page-Exit (进入与退出)这个是页面被载入和调出时的一些特效

<Meta http-equiv="Page-Enter" Content="blendTrans(Duration=0.5)">

<Meta http-equiv="Page-Exit" Content="blendTrans(Duration=0.5)">

 

name

1、Keywords (关键字)

用法:<Meta name="Keywords" Content="关键词1,关键词2,关键词3,关键词4,……">

2、Description (简介)

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

用法:<Meta name="Description" Content="你网页的简述">

4、Author (作者)

用法:<Meta name="Author" Content="张三,abc@sina.com">

5、Copyright (版权)

<Meta name="Copyright" Content="本页版权归Zerospace所有。All Rights Reserved">

posted @ 2018-05-07 10:19  ls-lansy  阅读(2157)  评论(0编辑  收藏  举报