常用meta标签整理

  • 2019 年 10 月 7 日
  • 筆記

常用meta标签列表,为了加强记忆,ytkah采用先放代码再放注释的形式,献给有需要的朋友们

<meta charset="utf-8">

  ↑↑↑ 设置页面编码为UTF8,防止乱码,需要页面保存为UTF8无BOM格式

<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>

  ↑↑↑ 这个属性常用于设计移动端网页

<meta http-equiv="X-UA-Compatible" content="IE=edge">

  ↑↑↑ 为IE设置兼容模式为edge

<meta name="keywords" content="关键词">  <meta name="description" content="描述">

  ↑↑↑ 页面关键词、描述

<meta name="robots" content="all">

  ↑↑↑ robots用来告诉爬虫哪些页面需要索引,哪些页面不需要索引。content的参数有all,none,index,noindex,follow,nofollow。默认是all。

具体参数如下:

1.none : 搜索引擎将忽略此网页,等价于noindex,nofollow。 2.noindex : 搜索引擎不索引此网页。 3.nofollow: 搜索引擎不继续通过此网页的链接索引搜索其它的网页。 4.all : 搜索引擎将索引此网页与继续通过此网页的链接索引,等价于index,follow。 5.index : 搜索引擎索引此网页。 6.follow : 搜索引擎继续通过此网页的链接索引搜索其它的网页。

<meta name="author" content="ytkah">

  ↑↑↑ 用于标注网页作者

<meta name="generator" content="PHPStorm">

  ↑↑↑ 用于标明网页是什么软件做的

<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"> 

  ↑↑↑ 显示并指定favicon图标的位置

<meta http-equiv="refresh" content="30">

  ↑↑↑ 网页将在设定的30秒后自动刷新

<meta http-equiv="refresh" content="5" url="https://www.cnblogs.com/ytkah">

  ↑↑↑ 网页将在设定的5秒时间后,自动刷新并调向设定的网址。

其他一些标签

<meta name="copyright" content="本页版权归XX所有,All Rights Reserved."> 标注版权

<base href="http://www.xx.com/" target="_blank"> 为相对地址指定基地址,并设置为新窗口打开

<meta name="format-detection" content="telephone=no"> 禁止电话号码识别

<meta name="format-detection" content="email=no"> 禁止邮箱识别

<meta name="format-detection" content="adress=no"> 禁止识别地址和跳转到地图功能

WebApp全屏模式:伪装app,离线应用。

<meta name="apple-mobile-web-app-capable" content="yes" /> <!– 启用 WebApp 全屏模式 –>

隐藏状态栏/设置状态栏颜色:只有在开启WebApp全屏模式时才生效。content的值为default | black | black-translucent 。

<meta name="apple-mobile-web-app-capable" content="yes"> 禁用工具栏与菜单栏,苹果系专属

<meta name="apple-mobile-web-app-status-bar-style" content="default"> 状态栏为默认样式,苹果系专属

<meta name="apple-mobile-web-app-status-bar-style" content="black"> 状态栏为黑色样式,苹果系专属

<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> 状态栏为灰色样式,苹果系专属

<meta name="apple-mobile-web-app-status-bar-style" content="blank"> 隐藏状态栏,苹果系专属