移动终端h5页面常用的meta属性

13 篇文章 0 订阅
11 篇文章 0 订阅

width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0

语法:

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

强制让文档的宽度与设备的宽度保持1:1,并且文档最大的宽度比例是1.0,且不允许用户点击屏幕放大浏览;
width - viewport的宽度 height - viewport的高度
initial-scale - 初始的缩放比例
minimum-scale - 允许用户缩放到的最小比例
maximum-scale - 允许用户缩放到的最大比例
user-scalable - 用户是否可以手动缩放

apple-mobile-web-app-capable

语法:

<meta name="apple-mobile-web-app-capable" content="yes">

apple-mobile-web-app-capable是设置web应用是否以全屏模式运行
说明:如果content设置为yes,web应用会以全屏模式运行。content设置为no,表示正常显示。可以通过只读属性window.navigator.standalone来确定网页是否以全屏显示。

apple-mobile-web-app-status-bar-style

语法:

<meta name="apple-mobile-web-app-status-bar-style" content="black">

iphone的私有标签,它指定在iphone中safari顶端的状态条的样式;在web app应用下状态条(屏幕顶部条)的颜色;
默认值为default(白色),可以定为black(黑色)和black-translucent(灰色半透明)。
注意:若值为“black-translucent”将会占据页面px位置,浮在页面上方(会覆盖页面20px高度–iphone4和itouch4的Retina屏幕为40px)

telephone=no

语法:

<meta name="format-detection" content="telephone=no" >

告诉设备忽略将页面中的数字识别为电话号码。

email=no

<meta name="format-detection" content="email=no" />

不识别邮箱

name=“Keywords”(关键字)

语法:

<meta name="Keywords" content="手机购物,WAP商城,日用百货,3C家电,汽车用品">

向搜索引擎说明你的网页的关键词

name=“description”(网页描述)

语法:

<meta name="description" content="京东手机版提供了包括数码、家电、手机、电脑配件、网络产品、日用百货等数万种商品,手机快捷购物,就上京东手机版。">

告诉搜索引擎你的站点的主要内容

name=“Author”(作者)

语法:

<meta name="Author" contect="你的姓名">

告诉搜索引擎你的站点的制作的作者

name="Copyright "(版权)

语法:

<Meta name="Copyright" Content="本页版权归Zerospace所有。All Rights Reserved">

标注版权

name=“Generator”(编辑器)

语法:

<Meta name="Generator" Content="PCDATA|FrontPage|">

注意:Content=“你所用编辑器”

name=“revisit-after”(重访)

语法:

<meta name="revisit-after" Content="7 days" >

通知搜索引擎多少天访问一次

name=“Robots”(机器人向导)

语法:

<meta name="Robots" contect="all | none | index | noindex | follow | nofollow">

其中的属性说明如下:
all:文件将被检索,且页面上的链接可以被查询;
none:文件将不被检索,且页面上的链接不可以被查询;
index:文件将被检索;
follow:页面上的链接可以被查询;
noindex:文件将不被检索,但页面上的链接可以被查询;
nofollow:文件将不被检索,页面上的链接可以被查询

apple-touch-icon和apple-touch-icon-precomposed

语法:

<link rel="apple-touch-icon" href="/static/images/identity/HTML5_Badge_64.png" />
<link rel="apple-touch-icon-precomposed" href="/static/images/identity/HTML5_Badge_64.png" />

iOS用rel=“apple-touch-icon”,android 用rel=“apple-touch-icon-precomposed”。这样就能在用户把网页存为书签时,在手机HOME界面创建应用程序样式的图标。

http-equiv=“Cache-Control”

语法:

<meta http-equiv="Cache-Control" content="no-cache" />

手机页面通常在第一次加载后会进行缓存,然后每次刷新会使用缓存而不是去重新向服务器发送请求。如果不希望使用缓存可以设置no-cache。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值