`

HTML Head Meta规范

阅读更多
一个标准的网页首先head区是需要比较规范的!
head区是指首页HTML代码的<head>和</head>之间的内容。

必须加入的标签

1.公司版权注释
<!--- The site is designed by Maketown,Inc 06/2000 --->

2.网页显示字符集
简体中文:<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
繁体中文:<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=BIG5">
英 语:<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">

3.网页制作者信息
<META name="author" content="[email]webmaster@xxxxx.com[/email]">

4.网站简介
<META NAME="DEscriptION" CONTENT="网站简介">

5.搜索关键字
<META NAME="keywords" CONTENT="关键字,关键字,关键字,关键字,关键字,">

6.网页的css规范
<LINK href="style/style.css" rel="stylesheet" type="text/css">
(参见目录及命名规范)

7.网页标题
<title>xxxxxxxxxxxxxxxxxx</title>
.可以选择加入的标签
1).设定网页的到期时间。一旦网页过期,必须到服务器上重新调阅。
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
2).禁止浏览器从本地机的缓存中调阅页面内容。
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
3).用来防止别人在框架里调用你的页面。
<META HTTP-EQUIV="Window-target" CONTENT="_top">
4).自动跳转。
<META HTTP-EQUIV="Refresh" CONTENT="5;URL=http://www.yahoo.com">
5指时间停留5秒。

5.网页搜索机器人向导.用来告诉搜索机器人哪些页面需要索引,哪些页面不需要索引。
<META NAME="robots" CONTENT="none">
CONTENT的参数有all,none,index,noindex,follow,nofollow。默认是all。

6.收藏夹图标
<link rel = "Shortcut Icon" href="favicon.ico">
所有的javascript的调用尽量采取外部调用.
<script LANGUAGE="javascript" SRC="script/xxxxx.js"></script>


附<body>标签:
<body>标签不属于head区,这里强调一下,为了保证浏览器的兼容性,必须设置页面背景
<body bgcolor="#FFFFFF">[/html]


新标准

<!--无为搜索 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; lang="gb2312">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="gb2312" />
<meta content="all" name="robots" />
<meta name="description"
content="iwbuy.com是一个搜索的网站,主要搜索音乐,flash,SEO,列车航班等等!
" />
<meta name="keywords" content="seo,flash,音乐,MTV,列车,航班" />
<meta name="author" content=fkasp@iwbuy.com,无为搜索 />
<meta name="Copyright" content="无为搜索" />
<title>无为搜索-音乐搜索-无为</title>
<!-- 调用样式表 -->
<link rel="stylesheet" href="images/style.css" _fcksavedurl=""images/style.css"" _fcksavedurl=""images/style.css"" _fcksavedurl=""images/style.css"" type="text/css" media="all" />
</head>


header中的内容

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><!--设置网页的文件编码-->
<meta http-equiv="expires" content="2005/05/05 18:00:00"><!--脱机浏览的过期时间-->
<meta http-equiv="pragma" content="no-cache"><!--禁止网页从缓存中读取-->
<meta http-equiv="Refresh" content="5;http://blog.csdn.net/overmind"><!--网页重新定向-->
<meta http-equiv="set-cookie" content="2005/05/05 18:00:00"><!--设置网页的cookie过期时间-->
<meta http-equiv="Window-target" content="_top"><!--设置网页中链接的目标窗口-->
<meta http-equiv="Page-Enter" content="revealTrans(duration=1000000,transition=50000000)"><!--设置网页的打开效果-->
<meta http-equiv="Page-Exit" content="revealTrans(duration=1000000,transition=50000000)"><!--设置网页的关闭效果-->
<meta name="keywords" content="overmind,zerg,protoss"><!--设置网页的关键字,搜索的时候优先!!!重要!!! 该数据被搜索引擎编入索引-->
<meta name="description" content="哈哈哈哈哈"><!--插入描述 搜索时被搜索引擎编入索引-->
<title>无标题文档</title>
</head>

<body>
aaa
</body>
</html>


最常用到的head原素

一:META

Meta:它可以记录当前页面的信息,例如字符编码、作者、版权和关键字等。还可以用来向服务器提供信息,例如截止日期和页面刷新间隔等。

META 有两种,name 和 http-equiv。

Name主要有:

<meta name="" content="">

<meta>的属性有:

author--(设置有关该网页作者的资料)

description---(可简述该网页的内容)

keywords----(可设置该网页中的关键字,不同关键字之间可用逗点隔开)

generator---(可设置该网页是通过那种软件所产生的)

revised-----(可设置该网页的版本)

others-----(可设置其它有关该网页的信息)
----------------------------------------------

content
属性

字符串---(可配合name或http-equiv属性来设置相关信息)

<meta name="ROBOTS" content="all | none | index | noindex | follow | nofollow"> 来确定:
  设定为"all"时文件将被检索,且页上链接可被查询;
  设定为"none"则表示文件不被检索,而且不查询页上的链接;
  设定为"index"时文件将被检索;
  设定为"follow"则可查询页上的链接;
  设定为"noindex"时文件不检索,但可被查询链接;
  设定为"nofollow"则表示文件不被检索,但可查询页上的链接.

http-equiv主要有:

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--网页内容类型,TXT或HTML格式,编码方式为GB2312 -->

<meta http-equiv="refresh" content="5;URL=index.htm">
<!--网页在5秒后自动刷新,链接地址为index.htm页. 使用Refresh元素可以指定在某一时间段后自动对页面对页面进行刷新。或是转到别的网站.-->

二:其它的元素:

<base href="" target="_blank">
<!--基本链接设定,目标为弹出新页面。此项可用于FRAME页中指定链接显示的FRAME,例如:target="main">

<link rel="stylesheet" href="mycss.css">
<!--调入样式表,链接样式表文件"mycss.css" -->

<meta http-equiv="Page-Enter" content="RevealTrans (Duration=3, Transition=23)">
<meta http-equiv="Page-Exit" content="RevealTrans (Duration=3, Transition=23)">
加入网页的过场效果 IE 支持


<MEAT HTTP-EQUIV="Pragma" CONTENT="no-cache">
对于不想加入浏览缓存的文件需要在加入代码

<link rel="shortcut icon" href="favicon.ico">
单页增加 IE5 的频道图标

<meta NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
防止别人用search bot,web spider之类的东西索引你的网页。 不常用但或许用得着。

来源:http://blog.csdn.net/coolpig86/article/details/5755485
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics