您的位置:首页 > Web前端 > HTML5

HTML5标签之<meta>

2013-03-28 20:28 357 查看
学习自W3school-html5

定义和用法:

<meta>元素可以提供有关页面的元信息(meta-information),比如针对搜索引擎和更新频度的描述和关键词。

<meta>标签位于文档的头部,不包含任何内容。<meta>标签的属性定义了与文档相关联的名称/值对。

html4.01与HTML5之间的差异:

在HTML中,不再支持scheme属性;

在HTML5中,有一个新的charset属性,它使字符集更加容易;

eg:

定义针对搜索引擎的关键词:

<meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript" />

定义对页面的描述:

<meta name="revised" content="David, 2008/8/8/" />

每5秒刷新一次页面:

<meta http-equiv="refresh" content="5" />

===================================================================

属性:charset

值:character encoding

描述:定义文档的字符编码。

属性:content

值:some_text

描述:定义与http-equiv或name属性相关的元信息。

属性:http-equiv

值:content-type, expires, refresh, set-cookie

描述:把content属性关联到HTTP头部

属性:name

值:author, description, keywords, generator, revised, others

描述:把HTTP关联到一个名称

属性:scheme

值:some_text

描述:定义与用于翻译content属性值的格式。不支持

=====================================================

比如:

<head>
<meta charset=utf-8>
<title>某公司的网站首页</title>
<meta name="keywords" content="HTML5">
<meta name="description" content="这是一个HTML5的试验页">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="0">
<meta name="author" content="Author:Adam">
<meta name="robots" content="ALL">
<meta name="copyright" content="HTML5 Developer Community">
<link href="style/main.css" rel="stylesheet" type="text/css">

</head>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: