你的位置:首页 > 软件开发 > 网页设计 > html5 移动适配写法

html5 移动适配写法

发布时间:2017-11-03 17:00:05
在pc版网页 上,添加:<link rel="alternate" media="only screen and(max-width: 640px)" href="http://pc_url" >在移动版网页 ...

在pc版网页 上,添加:

<link rel="alternate" media="only screen and(max-width: 640px)" href="http://pc_url" >

在移动版网页 上,所需的注释应为:

<link rel="canonical" href="http://mobile_url" >

之前的Meta标记(mobile agent)会继续沿用,但我们推荐使用HTMAL5语言制作的移动页面使用最新方案进行跳转适配,其它如

<meta name="mobile-agent"content="format=[wml|xhtml|html5]; url=mobile_url">

html5新增的移动适配写法如上,这个主要是为了百度等搜索引擎抓取到网站的移动端网址是什么,不是自动当设备切换到手机时自动跳转的.若实现自动跳转还需要js.

 

参考

原标题:html5 移动适配写法

关键词:HTML

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。