Mobile-page Layout

Source: Internet
Author: User

Mobile-page layoutmobile App Category

1. Native app native app mobile app
Mobile apps developed using native languages, the Android system uses the Java,ios system is object-c

2, Hybrid app hybrid app mobile app
Mixed use of native programs and HTML5 pages developed by mobile apps

3. Web App Web-based app mobile app
Full use of HTML5 page plus front-end JS framework development of mobile phone applications

Viewport Viewport

The viewport is the area on the mobile device used to display the page, generally larger than the mobile device viewable area, the width may be 980px or 1024px, the purpose is to display the entire PC-side design of the page, the result is the mobile side will appear horizontal scroll bar, in order to avoid this situation, The mobile side zooms the viewport to the size of the mobile window. This will make the page not easy to watch, you can use the META tag, name= "viewport" to set the viewport size, the size of the viewport is set to the same size as the mobile device visible area.

The Setup method is as follows:

PC-side and mobile-rendered web page process:


Retina screen (Retina screen) resolution solution

The Retina screen refers to a screen with a higher physical pixel density screen, the physical pixels can be understood as a luminous point on the screen, countless glowing dots composed of screens, retina screens smaller than the physical pixels of the general screen, a common twice times Retina screen and 3 times times the retina screen, twice times the retina screen, Its physical pixel point size is 1/4, 3 times times the retina screen of the general screen, and its physical pixel point size is 1/9 of the general screen.

The size of the image on the Retina screen is the same as the size shown on the general screen, but because the physical pixels of the retina screen are smaller than the average screen, the image appears to be magnified, the image becomes blurred, and in order to solve this problem, you can use an image that is twice as large as the original. Then using CSS style to force the image size to the original size of the image, you can solve the problem of ambiguity.

Clarity resolution process:


The background is forced to change size, you can use background new property

Background new properties
Background-size:

    • Length: Specifies the size of the background image with a long value. Negative values are not allowed.
    • Percentage: Specifies the background image size in percent. Negative values are not allowed.
    • Auto: The true size of the background image.
    • Cover: The background image is more than scaled to a fully covered container, and the background image may be out of the container.
    • Contain: The background image is always included in the container, such that the background image is equal to or greater than the width or height of the container.
pc and Mobile page adaptation method

There are a number of different resolutions for the device screen, and there are several options for page adaptation:

1. Pang with: Fluid layout + responsive layout
2, mobile-side adaptation:

    • Fluid Layout + Small response
    • REM-based layouts
    • Elastic box Model
Fluid Layout

Fluid layout, which is to use percentages to set the width of the element, the height of the element is fixed by the actual height, the fluid layout, the edge of the element cannot be used as a percentage, you can use the calculation function in the Style calc () to set the width, or use the Box-sizing property to set the box to calculate the box size from the edge.

Calc ()
The elements can be added in a calculated way, such as: Width:calc (25%-4px);

Box-sizing
1, content-box default box size calculation method
2. The size of the Border-box box is calculated from the frame, the size of the box, the frame and the inner padding are counted in the box size.

Responsive Layout

Responsive layout is the way to use media queries, by querying the browser width, different width of the different style blocks, each style block corresponding to the width of the layout, so as to achieve a responsive layout. Responsive layout pages can be adapted to a variety of terminal screens (PC, tablet, mobile).

The pseudo-code for the corresponding layout is as follows:

@media (max-width:960px){    .left_con{width:58%;}    .right_con{width:38%;}}@media (max-width:768px){    .left_con{width:100%;}    .right_con{width:100%;}}
REM-based layouts

First understand EM units, EM units are reference elements of their own text size to set the size, REM refers to the reference root node of the text size, the root node refers to the HTML tag, set the HTML tag text size, other elements related to the size of the set with REM, so that all elements have a unified reference standard, Changing the size of the HTML text will change the size of all elements with REM settings.

Cssrem Installation

Cssrem plug-in can dynamically convert PX dimensions to REM size

Download this project, for example: Git clone https://github.com/flashlizi/cssrem into packages directory: Sublime Text--Preferences, Browse Packages ... Copy the downloaded Cssrem directory into the Packges directory just now. Restart Sublime Text.

Configuration parameter profile: Sublime Text, Preferences, Package Settings, Cssrem px_to_rem-px to REM unit ratio, default is 40. MAX_REM_FRACTION_LENGTH-PX to the maximum length of the number of parts of REM. The default is 6. Available_file_types-Enables the file type of this plug-in. The default is: [". css", ". Less", ". Sass"].

Flexible box Model layout

1. Container Properties
Display:flex
Declaring the use of flexible box layouts

Flex-direction:row | Row-reverse | Column | Column-reverse
Determining the direction of child element arrangement

Flex-wrap:nowrap | Wrap | Wrap-reverse
Whether the element wraps when it exceeds the parent container size

flex-flow:flex-direction | Flex-wrap
Set Flex-direction and Flex-wrap at the same time

Justify-content:flex-start | Flex-end | Center | Space-between | Space-around
After the dimensions of the child elements are determined, use this property to set the distribution of the flex-direction definition direction

Align-items:flex-start | Flex-end | Center | Baseline | Stretch
After the dimensions of the child elements are determined, use this property to set the distribution of the vertical direction on the flex-direction defined direction

Align-content:flex-start | Flex-end | Center | Space-between | Space-around | Stretch
To set the alignment of multiline child elements in the row direction

2. Item properties
Flex:none | < ' Flex-grow ' > < ' flex-shrink > '? | | < ' flex-basis ' >
Also set Flex-grow and Flex-shrink and Flex-basis

Flex-grow:number
Represents the proportion of space that is allocated between different child elements when the parent element has extra space

Flex-shrink:number
When the parent element has insufficient space, the dimensions of each child element are scaled down

Flex-basis:length | Percentage | Auto | Content
Used to determine the initial spindle size of an elastic entry.

Align-self:auto | Flex-start | Flex-end | Center | Baseline | Stretch
Overwrite the alignment specified by the parent element

Order:integer
Change the order in which entries appear in the container

Mobile-page Layout

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.