
	前面有一篇文章介绍了HTML5的一些新特性以及技巧, 现再来总结一些更多的针对webkit的HTML, CSS和Javascript方面的特性.
	HTML, 从HTML文档的开始到结束排列:
	
		XML/HTML Code复制内容到剪贴板
	
		
			- 
				<meta name=”viewport” content=”width=device-width, initial-scale=1.0″/>   
- 
				  
- 
				<meta name=”format-detection” content=”telephone=no”]]>   
- 
				  
- 
				<link rel=”apple-touch-icon” href=”icon.png”/>   
- 
				  
- 
				<!– 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”>   
- 
				  
- 
				<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”>    
- 
				  
- 
				<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:
	
		CSS Code复制内容到剪贴板
	
		
			- 
				-webkit-tap-highlight-color: transparent;   
- 
				  
- 
				  
- 
				-webkit-user-select: none;   
- 
				  
- 
				  
- 
				-webkit-touch-callout: none;   
- 
				  
- 
				  
- 
				:-webkit-full-screen canvas {}   
- 
				  
- 
				  
- 
				div p :matches(em, b, strong) {}   
- 
				  
- 
				  
- 
				@media only screen and (max-width: 480px) {}   
- 
				  
- 
				  
- 
				@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;   
- 
				  
- 
				  
- 
				width: calc(100%-40px);   
- 
				  
- 
				  
- 
				text-decoration: #FF8800  wavy ine-through;   
- 
				  
- 
				  
- 
				text-rendering: optimizeLegibility;   
- 
				  
- 
				  
- 
				font-variant-ligatures:  common-ligatures;   
- 
				  
- 
				  
- 
				transform:  rotate(90);   
- 
				  
- 
				  
- 
				transform-origin: center center; transform-origin  
- 
				  
- 
				  
- 
				-webkit-appearance: none; -webkit-appearance  
- 
				  
 
 
	美化表单校验时的提示样式
	
		CSS Code复制内容到剪贴板
	
		
			- 
				-webkit-validation-bubble {}  
- 
				-webkit-validation-bubble-message {}  
- 
				-webkit-validation-bubble-arrow {}  
- 
				-webkit-validation-bubble-arrow-clipper {}  
 
 
	
	
		当提示出现时类似于下面的结构
	
		
			XML/HTML Code复制内容到剪贴板
		
			
				- 
					<div -webkit-validation-bubble>  
- 
					<div -webkit-validation-bubble-arrow></div>   
- 
					<div -webkit-validation-bubble-arrow-clipper></div>  
- 
					<div -webkit-validation-bubble-message>Error Message</div>   
- 
					</div>  
 
	 
 
	自定义webkit浏览器的滚动条, 见Google Reader等在Chrome/Safari下的效果, 下面是一个实例, 这个滚动条的样式代码如下
	
		CSS Code复制内容到剪贴板
	
		
			- 
				Customized WebKit Scrollbar     
- 
				::-webkit-scrollbar {    
- 
				width: 12px;    
- 
				}    
- 
				    
- 
				::-webkit-scrollbar-track {    
- 
				-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);    
- 
				-webkit-border-radius: 10px;    
- 
				border-radius: 10px;    
- 
				}    
- 
				     
- 
				    
- 
				::-webkit-scrollbar-thumb {    
- 
				-webkit-border-radius: 10px;    
- 
				border-radius: 10px;    
- 
				background: rgba(255,0,0,0.8);    
- 
				-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);    
- 
				}    
- 
				::-webkit-scrollbar-thumb:window-inactive {    
- 
				background: rgba(255,0,0,0.4);    
- 
				}    
- 
				-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;}    
- 
				  
 
 
	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)
	
		JavaScript Code复制内容到剪贴板
	
		
			- 
				window.addEventListener("orientationchange", function(e){  
- 
				  
- 
				}, false);  
- 
				   
- 
				window.addEventListener("deviceorientation", function(e){  
- 
				  
- 
				  
- 
				  
- 
				}, false);  
- 
				window.addEventListener("devicemotion", function(e){  
- 
				   
- 
				  
- 
				   
- 
				}, false);  
 
 
	requestAnimationFrame() 新的动画函数
	element.webkitRequestFullScreen() 调用全屏函数