近期Responsive web design项目经验分享

关于meta  
<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, user-scalable=0, width=device-width, minimal-ui">
minimal-ui 默认浏览器的URL缩小

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

这个meta标签表示:强制让文档的宽度与设备的宽度保持1:1,并且文档最大的宽度比例是1.0,且不允许用户点击屏幕放大浏览;

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

这个meta标签是iphone设备中的safari私有meta标签,它表示:允许全屏模式浏览;

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

这个meta标签也是iphone的私有标签,它指定的iphone中safari顶端的状态条的样式;

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

<meta name="apple-touch-fullscreen" content="yes">"添加到主屏幕“后,全屏显示 <meta name="apple-mobile-web-app-capable" content="yes" />
这meta的作用就是删除默认的苹果工具栏和菜单栏。content有两个值”yes”和”no”,当我们需要显示工具栏和菜单栏时,这个行meta就不用加了,默认就是显示。

<meta name=”apple-mobile-web-app-status-bar-style” content=black” /> 
默认值为default(白色),可以定为black(黑色)和black-translucent(灰色半透明)。
注意: 若值为“black-translucent”将会占据页面px位置,浮在页面上方(会覆盖页面20px高度–iphone4和itouch4的Retina屏幕为40px)。

在iOS中有两个meta值,apple-mobile-web-app-capable和apple-mobile-web-app-status-bar-style,这两个会让网页内容以应用程序风格显示,并使状态栏透明。
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">

<link rel="apple-touch-icon-precomposed" href="http://spion.blog.163.com/blog/iphone_milanoo.png" />
说明: 这个link就是设置web app的放置主屏幕上icon文件路径。
图片尺寸可以设定为57*57(px)或者Retina可以定为114*114(px),ipad尺寸为72*72(px)

<meta content="telephone=no" name="format-detection" />
<meta content="email=no" name="format-detection" />//将不识别邮箱
告诉设备忽略将页面中的数字识别为电话号码 

iOS用rel="apple-touch-icon",android 用rel="apple-touch-icon-precomposed"。这样就能在用户把网页存为书签时,在手机HOME界面创建应用程序样式的图标。
<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" />

 
关于字体单位
使用rem 相对单位 
 
关于宽度
使用百分比宽度布局
 
关于media
http://nmsdvid.com/snippets/ 这个网站里介绍的很全  有需要的要收藏 利器
 
关于图标
使用字体图标 我使用的是淘宝的字体图标  自定义图标需要上传符合格式的svg生成图标 存储相应项目
 
关于特殊CSS

9、手机浏览器多而乱,而且手机系统的默认处理方法也不同,兼容问题丝毫不比PC版的简单,所以要总结归纳常用的处理方法,

如-webkit-tap-highlight-color:rgba(0,0,0,0);/*禁止链接高亮*

/-webkit-touch-callout:none;/*禁止链接长按弹出选项菜单*/等等

http://ued.ctrip.com/blog/wp-content/webkitcss/  webkit 携程UED整理的资料 很全的

10、对手机平板的移动端来说,流量是很重要的,所以webapp中class和id的命名尽量断点,如头部可以命名为hd,中间为bd,底部为ft等(此建议待定,因为考虑到后期维护是否方便等问题);

关于动画animation

手机上不能在before,after等伪类上添加动画功能

关于border-radius

如果需要border描边  会在手机端出现BUG 没有圆角的效果  改为box-shadow模拟描边特效 

近期Responsive web design项目经验分享,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。