1, to prevent the mobile phone to enlarge and reduce the page, this is the most basic, the most mobile site developers should know, is to set the meta-viewport viewport
Some mobile website we see the following statement:
<! DOCTYPE HTML PUBLIC "-//wapforum//dtd XHTML Mobile 1.0//en" "Http://www.wapforum.org/DTD/xhtml-mobile10.dtd" >
The way the DTD is set is the XHTML notation, and if our page is using HTML5, you can simply declare <! without setting up a DTD. DOCTYPE html>.
Use viewport to prevent the page from zooming. Usually the user-scalable is set to zero to close the user's behavior on page view scaling.
Complete viewport setting, of course, user-scalable=0, some people also write user-scalable=no, can.
<meta name= "viewport" content= "Width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" >
2, some of the Apple phone settings.
<meta name= "apple-mobile-web-app-capable" content= "yes" >
If the content is set to yes,web the app will run in full-screen mode, or vice versa. The default value for content is no, which indicates normal display. You can use the read-only property window.navigator.standalone to determine whether a Web page is displayed in full-screen mode.
3, format-detection settings.
<meta name= "format-detection" content= "Telephone=no" >
<meta name= "format-detection" content= "Email=no" >
Format-detection Start or disable the phone number, email address in the auto-identify page.
4, pull the scroll bar up and down, slow
Body {
-webkit-overflow-scrolling:touch;
Overflow-scrolling:touch;
}
The new properties of android3+ and ios5+ support CSS3 are overflow-scrolling
5. Prohibit copying and selecting text
Element {
-webkit-user-select:none;
-moz-user-select:none;
-khtml-user-select:none;
User-select:none;
}
*:not (Input,textarea) {
-moz-user-select:none;
-o-user-select:none;
-khtml-user-select:none;
-webkit-user-select:none;
-ms-user-select:none;
User-select:none;
}
Resolve mobile devices to select page text (depending on product needs)
6, long time to press and hold the page flash back
element {
-webkit-touch-callout:none;
}
7. The default inner shadow of the input box under iphone and ipad
element{
-webkit-appearance:none;
}
8. Translucent gray Matte when touching elements under iOS and Android
Element {
-webkit-tap-highlight-color:rgba (255,255,255,0)
}
9, active compatibility processing is pseudo-class: Active failure
Method One: Body add Ontouchstart
<body ontouchstart= "" >
Method Two: JS to document BIND Touchstart or Touchend event
<style>
A
Color: #000;
}
a:active {
Color: #fff;
}
</style>
<a Herf=foo >bar</a>
<script>
Document.addeventlistener (' Touchstart ', function () {},false);
</script>
10. Animation Definition 3D Hardware acceleration enabled
Element {
-webkit-transform:translate3d (0, 0, 0)
Transform:translate3d (0, 0, 0);
}
Note: 3D distortion consumes more memory and power
11.1px Frame of Retina screen
element{
Border-width:thin;
}
12. When rotating the screen, the font size adjustment problem
*{
-webkit-text-size-adjust:100%;
}
13. Top status bar background color
<meta name= "Apple-mobile-web-app-status-bar-style" content= "Black"/>
Description
This meta tag will not work unless you first use apple-mobile-web-app-capable to specify full-screen mode.
If content is set to default, the status bar is displayed correctly. If set to blank, the status bar will have a black background. If set to Blank-translucent, the status bar appears as black translucent. If set to default or blank, the page appears below the status bar, where the status bar occupies the upper part, and the page occupies the lower part, which does not obscure or obscure the other. If set to Blank-translucent, the page fills the screen, where the top of the page is obscured by the status bar (which overrides the 20px height of the page, while the Retina screen for iphone4 and ITOUCH4 is 40px). Defaults are default values.
Compatibility IOS 2.1 +
14. Set the cache
<meta http-equiv= "Cache-control" content= "No-cache"/>
Mobile pages are usually cached after the first load, and then each refresh uses the cache instead of going back to the server to send the request. If you do not want to use the cache, you can set No-cache.
15. Desktop icons
<link rel= "Apple-touch-icon" href= "Touch-icon-iphone.png"/>
<link rel= "Apple-touch-icon" sizes= "76x76" href= "Touch-icon-ipad.png"/>
<link rel= "Apple-touch-icon" sizes= "120x120" href= "Touch-icon-iphone-retina.png"/>
<link rel= "Apple-touch-icon" sizes= "152x152" href= "Touch-icon-ipad-retina.png"/>
16. Browser private and other meta
QQ Browser Private
Full Screen mode
<meta name= "X5-fullscreen" content= "true" >
Force vertical Screen
<meta name= "X5-orientation" content= "Portrait" >
Force horizontal Screen
<meta name= "x5-orientation" content= "Landscape" >
Application Mode
<meta name= "X5-page-mode" content= "App" >
UC Browser Private
Full Screen mode
<meta name= "Full-screen" content= "yes" >
Force vertical Screen
<meta name= "Screen-orientation" content= "Portrait" >
Force horizontal Screen
<meta name= "screen-orientation" content= "Landscape" >
Application Mode
<meta name= "Browsermode" content= "Application" >
Other
Optimized for handheld devices, mainly for older browsers that do not recognize viewport, such as BlackBerry
<meta name= "handheldfriendly" content= "true" >
Microsoft's old-fashioned browser
<meta name= "mobileoptimized" content= ">"
Windows Phone clicks No highlight
<meta name= "Msapplication-tap-highlight" content= "no" >
17, iOS input keyboard event KeyUp, KeyDown, keypress support is not very good
The problem is that when using input search to do fuzzy search, in the keyboard input keywords, will be through the Ajax background query, and then return the data, and then the returned data for the keyword red. Using input to monitor the keyboard KeyUp event, in the Android phone browser is possible, but in the iOS phone browser red very slow, with input methods, not immediately corresponding KeyUp events, only after the deletion can be appropriate!
WORKAROUND: You can use the HTML5 Oninput event to replace the KeyUp
<input type= "text" id= "Testinput" >
<script type= "Text/javascript" >
document.getElementById (' Testinput '). AddEventListener (' input ', function (e) {
var value = E.target.value;
});
</script>
18 ' The blue number on the phone (7 digits; The phone will default to the phone number; You can click to dial; the date of the background request is also blue) Resolve:
<meta name = "format-detection" content = "Telephone=no,date=no,address=no,email=no" >
19 scroll bar on the Apple phone to scroll not smooth with the following attributes on it;
-webkit-overflow-scrolling:touch;
20.
/*a Link Click the picture appears Flash * *
Html{-webkit-tap-highlight-color:none}
Html{-webkit-tap-highlight-color:transparent;}
Mobile development Notes-Iteration Records