Summary of WEBAPP development skills (notes for mobile website development)

Summary of WEBAPP development skills (notes for mobile website development)

1. To develop web responsively, the page must adapt to the screen size. You can use fluid layout, as in the previous article (adaptive width layout). Other specific minor problems can be solved by using media query (let IE support CSS3 Media Query to achieve responsive web design and CSS3 Media Queries).
2. Because most mobile phones have advanced browsers, you can use HTML5+CSS3 development;
3. Use meta tags reasonably and flexibly, as follows;


Copy code
The code is as follows:

<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<meta content="telephone=no" name="format-detection" />


The first meta tag means: force the document width to be 1:1 with the device width, and the maximum document width ratio is 1.0, and do not allow users to click on the screen to zoom in.
The second meta tag is a private meta tag for Safari on iPhone devices, which means: allow full-screen mode browsing;
The third meta tag is also a private tag for iPhone, which specifies the style of the status bar at the top of Safari on iPhone;
The fourth meta tag means: Tell the device to ignore the numbers in the page as phone numbers. For examples, see: Common meta tag examples

4. Pay attention to the size of the link, because most of them are touch-screen phones, so users should be able to click on the label easily (I have seen an article before, but I can't find the source now. It seems that the minimum size is 42px*42px):

The size of the operation object is in line with the finger operation, and the size of the key is set in accordance with the specification:
The index finger click spacing is about 7*7 mm, 1mm spacing,
Thumb click 8*8 mm, 2mm spacing. The currently recommended value is 9mm, and the minimum should be no less than 7mm.
Of course, some important operations or frequently clicked areas can be set slightly larger.

5. Graceful degradation (smooth degradation) should be achieved, and JS and images should be used less. The page should also reflect its value when users prohibit downloading JS and images (because many apps are set by default not to automatically download images and other resources under 3G).
6. For image processing, just set the width to make the image adaptive and prevent it from deforming. Of course, when the resolutions of compatible devices vary greatly, you need to use media queries to load different images according to different resolutions (the same image needs to be set to several different specifications). This is to prevent small-resolution devices from loading large images and wasting traffic, and to prevent large-resolution devices from loading small images and causing image blur.
7. When the resolution is set too small and the normal modules appear too crowded, you can use media queries to display or hide modules appropriately according to the resolution, such as displaying a 2-column layout at 768px and a 1-column layout at 320px.


Copy code
The code is as follows:

/* Large desktop */
@media (min-width: 1200px) { ... }

/* Portrait tablet to landscape and desktop */
@media (min-width: 768px) and (max-width: 979px) { ... }

/* Landscape phone to portrait tablet */
@media (max-width: 767px) { ... }

/* Landscape phones and down */
@media (max-width: 480px) { ... }

8. Of course, you can also jump to different URLs based on different terminals, see: JavaScript for mobile terminals such as mobile phones and tablets to adapt to jump URLs
9. There are many mobile browsers, and the default processing methods of mobile systems are also different. The compatibility issue is no simpler than that of the PC version, so it is necessary to summarize the commonly used processing methods, such as -webkit-tap-highlight-color:rgba(0,0,0,0); /*Disable link highlighting*/ -webkit-touch-callout:none; /*Disable link long press to pop up the option menu*/, etc.
10. Traffic is very important for mobile phones and tablets, so the names of classes and IDs in webapp should be as discrete as possible, such as hd for the head, bd for the middle, ft for the bottom, etc. (This suggestion is pending because it takes into account whether it is convenient for later maintenance and other issues);

<<:  Detailed explanation of the differences between similar tags and attributes in HTML

>>:  CSS3 filter (filter) to achieve the sample code of gray or black mode of web page

Recommend

Steps to set up and mount shared folders on Windows host and Docker container

Programs in Docker containers often need to acces...

The difference between HTML iframe and frameset_PowerNode Java Academy

Introduction 1.<iframe> tag: iframe is an i...

How to solve the mysql error 1033 Incorrect information in file: 'xxx.frm'

Problem Description 1. Database of the collection...

A brief analysis of the four import methods and priorities in CSS

First: 4 ways to introduce CSS There are four way...

A brief talk about JavaScript variable promotion

Table of contents Preface 1. What variables are p...

How to reset the root password in CentOS7

There are various environmental and configuration...

mysql method to view the currently used configuration file my.cnf (recommended)

my.cnf is the configuration file loaded when MySQ...

A brief discussion on the problem of forgotten mysql password and login error

If you forget your MySQL login password, the solu...

Detailed description of shallow copy and deep copy in js

Table of contents 1. js memory 2. Assignment 3. S...

Vue integrates PDF.js to implement PDF preview and add watermark steps

Table of contents Achieve results Available plugi...

Analysis of the HTML writing style and reasons of experienced people

1. Navigation: Unordered List vs. Other Label Ele...

How to verify whether MySQL is installed successfully

After MySQL is installed, you can verify whether ...

A thorough analysis of HTML special characters

A Thorough Analysis of HTML (14) Special Characte...

Solution to the garbled problem of web pages when the encoding is set to utf-8

Recently, when I was writing web pages with PHP, I...