meta
meta用于提供有关页面的元信息,例如针对搜索引擎的描述(description) 与 关键词(keywords).
常位于html头部,其属性定义了与html相关联的名称/值对.
charset
其值规定html的字符编码,常为:utf-8.
content
定义与 http-equiv 或 name 属性相关的元信息。
name
- application-name: 规定页面所代表的web应用程序的名称
- author: 规定作者名字
- description: 规定页面的描述。搜索引擎会把这个描述显示在搜索结果中
- keywords: 规定一个逗号分隔的关键词列表 - 相关的网页(告诉搜索引擎页面是与什么相关的)
http-equiv
- content-type: 规定字符编码
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
- default-style: 规定要使用的样式表
- refresh: 定义文档自动刷新的时间间隔
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--
name:指定的数据名称
content:指定的数据的内容,定义与name/http-equiv相关的内容
keywords 网站的关键字,可以同时指定多个关键字 ‘,’隔开;
比如京东网页源码;
description 用于指定网站的描述,显示在搜索引擎的搜索结果中
<meta name="description" content="这是网站描述">
-->
<meta name="keywords" content="html,css3">
<meta name="description" content="这是网站描述">
<!--
将页面重定向到另一个网站,3是指3秒后跳转;
<meta http-equiv="refresh" content="3;url=https://www.baidu.com">
-->
<meta http-equiv="refresh" content="3;url=https://www.baidu.com">
<title>Document</title>
</head>
<body>
<p>3秒后跳转</p>
</body>
</html>