meta元素提供的信息是用户不可见的,它不显示在页面中,一般用来定义页面信息的名称、关键字、作者等。meta不需要设置结束标记,一个尖括号内就是一个meta内容,一个HTML页面中可以有多个meta元素。meta有两种属性:name和http-equiv.
语法:<meta  name="keyword"content="具体的关键字">其中name为属性名称,content中定义了具体的关键字内容。
实例代码:
<html>
<head>
<title>学习元信息标记</title>
<meta name="keyword"content="html,元信息,关键字">
<meta name="description"content="关于HTML使用的网站">
<meta name="generator"content="Macromedia Dreamweaver MX 2004">

</head>
<body>
</body>
</html>
上面代码中,description 是设置页面描述,generator是设置编辑工具。
设定作者信息代码:
<html>
<head>
<title>学习元信息标记</title>
<meta name="keyword"content="html,元信息,关键字">
<meta name="description"content="关于HTML使用的网站">
<meta name="generator"content="Macromedia Dreamweaver MX 2004">
<meta name="author"content="阿峦">
</head>
<body></body>
</html>
限制搜索方式,实例代码:
<html>
<head>
<title>限制搜索方式</title>
<meta name="robots"content="index">
</head>
<body></body>
</html>
设置网页文字及语言
语法:<meta  http-equiv="content-type"content="text/html;charset字符集类型">
            <meta http-equiv="Content-Language"content="语言">
http-equiv用于传送HTTP通信协议的标头,也就是设定标头属性的名称,content中式具体的属性值。
<html>
<head>
<meta http-equiv="Content-type"content="text/html;charset=euc-kr">
<title>设定其他语言</title>
</head>
<body></body>
</html>
设置网页的定时跳转
语法:<meta  http-equiv="refresh"content="跳转时间;url=链接地址">
<html>
<head>
<title>学习元信息标记</title>
<meta http-equiv="refresh"content="3;url=http://www.sohu.com">
</head>
<body>
您好,本页在3秒之后将自动跳转到搜狐网站
</body>
</html>
当语法中的链接地址被省略是,网页的功能就变成了刷新页面本身,这在不断更新数据的页面中常常用到。刷新页面的代码如下:
<html>
<head>
<title>页面的刷新</title>
<meta http-equiv="refresh"content="60">
</head>
<body>
您好,本页每隔1分钟自动刷新一次
</body>
</html>
设定网页的到期时间
语法:<meta  http-equiv="expires"content="到期的时间">其中到期的时间必须是GMT时间格式。
实例代码:
<html>
<head>
<title>设置页面的到期时间</title>
<meta http-equiv="expires"content="Wed,27 July 2005 11:00:00 GMT">
</head>
<body>
</body>
</html>
禁止从缓存中调用
语法:<meta  http-equiv="cache-control"content="no-cache">
            <meta  http-equiv="prama"content="no-cache">
cache-control和pragma都可以用来设定缓存的属性,content中是真正禁止调用缓存的语句。
实例代码:
<html>
<head>
<title>设置禁止调用缓存</title>
<meta http-equiv="cache-control"content="no-cache">
</head>
<body></body>
</html>
删除过期的cookie
语法:<meta  http-equiv="set-cookie"content="到期的时间">
实例代码:
<html>
<head>
<title>删除过期的cookie</title>
<meta http-equiv="set-cookie"content="Wed,27 July 2005 11:00:00 GMT">
<body></body>
</html>
强制打开新窗口:强制页面在当前窗口中以独立的页面显示,可以防止自己的网页被别人当作一个frame也调用
语法:<meta  http-equiv="windows-target"content="_top">其中windows-target表示新网页的打开方式,而content中设置的_top则代表打开的是一个独立页面
实例代码:
<html>
<head>
<title>强制打开为独立页面</title>
<meta http-equiv="windows-target"content="_top">
<body></body>
</html>
设置网页的过度效果
语法:<meta  http-equiv="过渡事件"content="revealrans(duration=过渡效果持续时间,transition="过渡方式")">
建立离开过渡效果的页面14_exit.html,代码如下:
<html>
<head>
<title>页面的退出效果</title>
<meta http-equiv="page-exit"content="revealtrans(duration=3,transition=12)">
</head>
<body>
         <center>
                 <img src="14/01.jpg"width="350"height="247"><br><br>
                    </center>
</body>
</html>
建立中间过渡的页面14_page.html,代码如下:
<html>
<head>
<title>页面的过渡效果</title>
</head>
<body>
    <center>
            <img src="14/02.jpg"width=350 height=247><br><br>
            <a href="14enter.html">进入网页</a>
            </center>
</body>
</html>
创建要显示进入过渡效果的页面14enter.html,代码如下:
<html>
<head>
<title>进入页面的过渡效果</title>
<meta http-equiv="page-entet"content="revealtrans(duration=3,transition=22)">
</head>
<body>
     <center>
        <img src="14/03.jpg"width=350 height=247><br><br>
        </center>
</body>
</html>