The current mainstream mobile device system includes Android,ios, Symbian,blackberry and Web OS. These system browsers are based on the WebKit core, and WebKit claims to be a full-featured mobile browser that supports HTML + CSS + JavaScript, but because of the difference between the mobile device itself and the PC, the Web page we develop will always have some undesirable place on the mobile device.
Viewport translated into Chinese can be called "viewport", we all know that the mobile device screen is much smaller than the PC, WebKit browser will be a larger "virtual" window mapped to the mobile device screen, the default virtual window for 980 like wide (most of the current site's standard width), Then scale at a certain scale (3:1 or 2:1). That is, when we load a normal Web page, WebKit will load the Web page with a 980-pixel browser standard and then reduce it to a width of 490 pixels. Note that this reduction is a global narrowing, which means that all elements on the page will shrink.
So can we change the WebKit's viewport? Of course, add the following viewport code:
<meta name= "viewport" content= "width=500"/>
So is there a better way? for example, we automatically detect the size of the mobile device screen and then make the content adaptive. Very simple, looks like the code of the face:
<meta name= "viewport" content= "Width=device-width"/>
Device-width will automatically detect the screen width of the mobile device. All page content is adaptive to the mobile device screen.