meta标签的常用属性

属性名 属性值 描述
charset charset=”UTF-8” 设置页面编码
name name=”viewport” content=”width=device-width, initial-scale=1.0” 设置页面自适应设备大小
name keywords 网页的关键字,关键字之间用逗号隔开
name description 网页的描述内容
name robots 告诉搜索引擎是否允许索引与查询,默认值为all
name author 标注网页的作者
http-equiv http-equiv=”X-UA-Compatible” content=”ie=edge” 开启浏览器最高内核
http-equiv http-equiv=”Refresh” content=”5;url=http://www.baidu.com 5秒后跳转到百度
http-equiv set-cookie 设置页面缓存过期时间
http-equiv expires 设置页面到期时间

实例代码

这是一个页面跳转效果

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta http-equiv="Refresh" content="5;url=http://www.baidu.com">
    <meta name="keywords" content="网站关键字">
    <meta name="description" content="网站描述">
    <meta name="author" content="页面作者">
    <meta name="robots" content="all">
    <title>html标签练习2</title>
</head>
<body>
    Meta标签的使用,5秒后进入百度
</body>
</html>