针对webkit的HTML, CSS和Javascript
2012-03-08 00:35
183 查看
HTML,从HTML文档的开始到结束排列:
<meta name=”viewport” content=”width=device-width,initial-scale=1.0″/> 让内容的宽度自适应为设备的宽度,在做Mobile Web时必须加的一条
<meta name=”format-detection” content=”telephone=no”]]> 禁用手机号码链接(for iPhone)
<link rel=”apple-touch-icon” href=”icon.png”/> 设置你网页的图标,尺寸为57X57 px
<!– iOS 2.0+:tell iOS not to apply any glare effects to the icon –>
<link rel=”apple-touch-icon-precomposed” href=”icon.png”/>
<!– iOS 4.2+ icons for different resolutions –>
<link rel=”apple-touch-icon” sizes=”72×72″ href=”touch-icon-ipad.png” />
<link rel=”apple-touch-icon” sizes=”114×114″ href=”touch-icon-iphone4.png” />
<link rel=”apple-touch-startup-image” href=”startup.png”> 全屏启动时候的启动画面图像,尺寸320X460 px
<meta name=”apple-mobile-web-app-capable” content=”yes” /> 是否允许全屏显示,只有在桌面启动时可用
<meta name=”apple-mobile-web-app-status-bar-style” content=”black” /> 控制全屏时顶部状态栏的外观,默认白色
<input autocorrect=”off” autocomplete=”off” autocapitalize=”off”> 取消自动完成,自动大写单词字母(适用于Mobile上)
<input type=”text” x-webkit-speech /> 语音输入
<input type=”file” accept = “image/*; capture=camera” /> 文件上传,从相机捕获媒体,下同
<input type=”file” accept = “video/*; capture=camcorder” />
<input type=”file” accept = “audio/*; capture=microphone” />
<a href=”sms:18005555555,18005555556″]]> 发送短信给多个人 的链接
<a href=”sms:18005555555?body=Text%20goes%20here”]]> 发送短信附带内容 的链接
<a href=”tel:18005555555″]]>Call us at 1-800-555-5555</a]]> 拨打电话 的链接
CSS:
-webkit-tap-highlight-color:transparent; Mobile上点击链接高亮的时候设置颜色为透明
-webkit-user-select:none; 设置为无法选择文本
-webkit-touch-callout:none; 长按时不触发系统的菜单,可用在图片上加这个属性禁止下载图片
:-webkit-full-screen canvas {} 全屏模式时的样式(for Desktop)
div p :matches(em,b,strong) {} 使用mathes来匹配多个选择器
@media only screen and (max-width:480px) {} 指定Mobile设备或者小屏幕桌面屏幕
@media (-webkit-min-device-pixel-ratio:2),(min-resolution:300dpi) { 指定高分辨率屏幕设备
header { background-image:url(header-highres.png); }
}
@media (-webkit-max-device-pixel-ratio:1.5),(max-resolution:299dpi) { 指定低分辨率屏幕设备
header { background-image:url(header-lowres.png); }
}
background-repeat: space; background-repeat:round; 这两种CSS3的背景属性值得研究
width:calc(100%-40px); 计算宽度
text-decoration:#FF8800 wavy ine-through; 波浪型链接
text-rendering:optimizeLegibility; 用这个属性之后会收紧字符间的距离
font-variant-ligatures: common-ligatures; 设置CSS连字
transform: rotate(90); 旋转90度
transform-origin:center center; transform-origin可以改变变换的位置
-webkit-appearance:none; -webkit-appearance可以改变按钮或者其它控件看起来类似本地的控件
美化表单校验时的提示样式
当提示出现时类似于下面的结构
自定义webkit浏览器的滚动条,见Google Reader等在Chrome/Safari下的效果,下面是一个实例,这个滚动条的样式代码如下:
view source
print?
-webkit-background-composite:plus-darker; -webkit-background-composite用来设置一个元素的背景或颜色的组合样式
-webkit-text-stroke: 1px rgba(0,0,0,0.5); -webkit-text-stroke可以用来给文字添加描边
-webkit-mask-image: url(/path/to/mask.png); 定义一个图片用来遮罩元素
-webkit-box-reflect: below 5px; 定义了一个元素的反射
:local-link {font-weight:normal;} local-link可以定义相对地址的链接样式
Javascript:
window.scrollTo(0,0); 隐藏地址栏
window.matchMedia(); 匹配媒体
navigator.connection; 决定手机是否运行在WiFi/3G等网络
window.devicePixelRatio; 决定屏幕分辨率(iPhone 4值为2,而Nexus One值为1.5)
window.navigator.onLine; 取得网络连接状态
window.navigator.standalone; 决定iPhone是否处于全屏状态
touch事件 (iOS,Android 2.2+):touchstart,touchmove,touchend,touchcancel
gesture事件 (Apple only,iOS 2+): gesturestart,gesturechange,gesturend give access to predefined gestures (rotation,scale,position)
requestAnimationFrame() 新的动画函数
element.webkitRequestFullScreen() 调用全屏函数
<meta name=”viewport” content=”width=device-width,initial-scale=1.0″/> 让内容的宽度自适应为设备的宽度,在做Mobile Web时必须加的一条
<meta name=”format-detection” content=”telephone=no”]]> 禁用手机号码链接(for iPhone)
<link rel=”apple-touch-icon” href=”icon.png”/> 设置你网页的图标,尺寸为57X57 px
<!– iOS 2.0+:tell iOS not to apply any glare effects to the icon –>
<link rel=”apple-touch-icon-precomposed” href=”icon.png”/>
<!– iOS 4.2+ icons for different resolutions –>
<link rel=”apple-touch-icon” sizes=”72×72″ href=”touch-icon-ipad.png” />
<link rel=”apple-touch-icon” sizes=”114×114″ href=”touch-icon-iphone4.png” />
<link rel=”apple-touch-startup-image” href=”startup.png”> 全屏启动时候的启动画面图像,尺寸320X460 px
<meta name=”apple-mobile-web-app-capable” content=”yes” /> 是否允许全屏显示,只有在桌面启动时可用
<meta name=”apple-mobile-web-app-status-bar-style” content=”black” /> 控制全屏时顶部状态栏的外观,默认白色
<input autocorrect=”off” autocomplete=”off” autocapitalize=”off”> 取消自动完成,自动大写单词字母(适用于Mobile上)
<input type=”text” x-webkit-speech /> 语音输入
<input type=”file” accept = “image/*; capture=camera” /> 文件上传,从相机捕获媒体,下同
<input type=”file” accept = “video/*; capture=camcorder” />
<input type=”file” accept = “audio/*; capture=microphone” />
<a href=”sms:18005555555,18005555556″]]> 发送短信给多个人 的链接
<a href=”sms:18005555555?body=Text%20goes%20here”]]> 发送短信附带内容 的链接
<a href=”tel:18005555555″]]>Call us at 1-800-555-5555</a]]> 拨打电话 的链接
CSS:
-webkit-tap-highlight-color:transparent; Mobile上点击链接高亮的时候设置颜色为透明
-webkit-user-select:none; 设置为无法选择文本
-webkit-touch-callout:none; 长按时不触发系统的菜单,可用在图片上加这个属性禁止下载图片
:-webkit-full-screen canvas {} 全屏模式时的样式(for Desktop)
div p :matches(em,b,strong) {} 使用mathes来匹配多个选择器
@media only screen and (max-width:480px) {} 指定Mobile设备或者小屏幕桌面屏幕
@media (-webkit-min-device-pixel-ratio:2),(min-resolution:300dpi) { 指定高分辨率屏幕设备
header { background-image:url(header-highres.png); }
}
@media (-webkit-max-device-pixel-ratio:1.5),(max-resolution:299dpi) { 指定低分辨率屏幕设备
header { background-image:url(header-lowres.png); }
}
background-repeat: space; background-repeat:round; 这两种CSS3的背景属性值得研究
width:calc(100%-40px); 计算宽度
text-decoration:#FF8800 wavy ine-through; 波浪型链接
text-rendering:optimizeLegibility; 用这个属性之后会收紧字符间的距离
font-variant-ligatures: common-ligatures; 设置CSS连字
transform: rotate(90); 旋转90度
transform-origin:center center; transform-origin可以改变变换的位置
-webkit-appearance:none; -webkit-appearance可以改变按钮或者其它控件看起来类似本地的控件
美化表单校验时的提示样式
1 | ::-webkit-validation-bubble {} |
2 |
3 | ::-webkit-validation-bubble-message {} |
4 |
5 | ::-webkit-validation-bubble-arrow {} |
6 |
7 | ::-webkit-validation-bubble-arrow-clipper {} |
1 | < div -webkit-validation-bubble> |
2 |
3 | < div -webkit-validation-bubble-arrow></ div > |
4 |
5 | < div -webkit-validation-bubble-arrow-clipper></ div > |
6 |
7 | < div -webkit-validation-bubble-message>Error Message</ div > |
8 |
9 | </ div > |
view source
print?
01 | Customized WebKit Scrollbar /* Let´s get this party started */ |
02 |
03 | ::-webkit-scrollbar { |
04 |
05 | width : 12px ; |
06 |
07 | } |
08 |
09 | /* Track */ |
10 |
11 | ::-webkit-scrollbar-track { |
12 |
13 | -webkit-box-shadow: inset 0 0 6px rgba( 0 , 0 , 0 , 0.3 ); |
14 |
15 | -webkit-border-radius: 10px ; |
16 |
17 | border-radius: 10px ; |
18 |
19 | } |
20 |
21 | /* Handle */ |
22 |
23 | ::-webkit-scrollbar-thumb { |
24 |
25 | -webkit-border-radius: 10px ; |
26 |
27 | border-radius: 10px ; |
28 |
29 | background :rgba( 255 , 0 , 0 , 0.8 ); |
30 |
31 | -webkit-box-shadow: inset 0 0 6px rgba( 0 , 0 , 0 , 0.5 ); |
32 |
33 | } |
34 |
35 | ::-webkit-scrollbar-thumb:window-inactive { |
36 |
37 | background :rgba( 255 , 0 , 0 , 0.4 ); |
38 |
39 | } |
-webkit-text-stroke: 1px rgba(0,0,0,0.5); -webkit-text-stroke可以用来给文字添加描边
-webkit-mask-image: url(/path/to/mask.png); 定义一个图片用来遮罩元素
-webkit-box-reflect: below 5px; 定义了一个元素的反射
:local-link {font-weight:normal;} local-link可以定义相对地址的链接样式
Javascript:
window.scrollTo(0,0); 隐藏地址栏
window.matchMedia(); 匹配媒体
navigator.connection; 决定手机是否运行在WiFi/3G等网络
window.devicePixelRatio; 决定屏幕分辨率(iPhone 4值为2,而Nexus One值为1.5)
window.navigator.onLine; 取得网络连接状态
window.navigator.standalone; 决定iPhone是否处于全屏状态
touch事件 (iOS,Android 2.2+):touchstart,touchmove,touchend,touchcancel
gesture事件 (Apple only,iOS 2+): gesturestart,gesturechange,gesturend give access to predefined gestures (rotation,scale,position)
01 | window.addEventListener( "orientationchange" , function (e){ |
02 |
03 | //window.orientation(0 is portrait,90 and -90 are landscape) |
04 |
05 | }, false ); |
06 |
07 | window.addEventListener( "deviceorientation" , function (e){ |
08 |
09 | //e.alpha |
10 |
11 | //e.beta |
12 |
13 | //e.gamma |
14 |
15 | }, false ); |
16 |
17 | window.addEventListener( "devicemotion" , function (e){ |
18 |
19 | //e.accelerationIncludingGravity.x |
20 |
21 | //e.accelerationIncludingGravity.y |
22 |
23 | //e.accelerationIncludingGravity.z |
24 |
25 | }, false ); |
element.webkitRequestFullScreen() 调用全屏函数
相关文章推荐
- Mobile Web Development: 针对webkit的HTML, CSS和Javascript
- 针对webkit的HTML, CSS和Javascript
- 针对webkit的HTML, CSS和Javascript
- 总结一些更多的针对webkit的HTML, CSS和Javascript方面的特性.
- 总结一些更多的针对webkit的HTML, CSS和Javascript方面的特性.
- 针对webkit的HTML, CSS和Javascript(记录)
- 重新认识HTML,CSS,Javascript 之node-webkit 初探
- 又一次认识HTML,CSS,Javascript 之node-webkit 初探
- 重新认识HTML,CSS,Javascript 之node-webkit 初探
- 学习总结HTML CSS JAVASCRIPT,对三剑客的一些理解
- 【HTML & CSS & JavaScript】overflow属性滚动机制
- Dreamweaver CS5 CS6 代码格式化、美化插件(可同一时候格式化HTML、JavaScript、CSS )眼下最好用的代码格式化扩展
- 针对谷歌默认最小字体12px的正确解决方案 (css、html)
- HTML、CSS、JavaScript等Web开发技术电子资料汇总
- 1st JavaScript Editor Pro 3.8,强大的JavaScript开发工具(JavaScript IDE),完美支持CSS, HTML, DOM and DHTML开发、校验、调试
- 新手理解HTML、CSS、javascript之间的关系
- eclipse aptana插件 —— 【javascript|html|css|jquery|…】自动提示
- HTML+CSS+JavaScript小例题
- html、css和javascript入门
- 领航致远_李腾飞老师javascript_html_css视频教程