The third part-----mobile development and response style

Source: Internet
Author: User

PART-1 Mobile Development Common skills

"Viewport basic knowledge"

Set the various information for the layout viewport:


1. Width=device-width: Set viewport viewport width equal to device width
2, initial-scale=1: page Default scaling ratio is 1 (Web page does not scale on the handheld device)
3, minimum-scale=1: Web page Minimum scaling ratio is 1
4, maximum-scale=1: page Maximum zoom ratio is 1
5, User-scalable=no: Prohibit users to manually zoom the page. Failure of equipment above IOS10

Note: inmobile stations and responsive websitesIn the production,required to addThe following statement.

<meta name= "viewport" content= "width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1, User-scalable=no "/>


prohibit the device to identify the mobile phone number, mailbox, cancel click to call the event

<meta name= "format-detection" content= "Telephone=no,email=no"/>

when iOS is added to the home screen, the WebApp title

<meta name= "Apple-mobile-web-app-title" content= "title" >

when iOS is added to the home screen, whether to enable WebApp full-screen mode, delete the top address bar and the bottom toolbar

<meta name= "apple-mobile-web-app-capable" content= "yes"/>

the top status bar color of the Web app when iOS is added to the home screen:
Black: White,black-translucent Black Translucent, when set to translucent, the page fills the entire screen, and the top transparent status bar will cover the page
At the top of a strip.

<meta name= "Apple-mobile-web-app-status-bar-style" content= "Black" >

the WebApp icon when iOS is added to the home screen.

<link rel= "apple-touch-icon-precomposed" href= ""/>

Set the browser to use the latest IE or Google Zone compilation.
NOTE: This SET statement is not dedicated to the mobile phone, the General PC Web page needs to be set. (usually added)

<meta http-equiv= "x-ua-compatible" content= "ie=edge,chrome=1"/>


"phone-side font style"


1, the general mobile phone does not support Microsoft Ya-Black font
2, the Chinese font is generally not set, using the system default can
3, English font is generally set to Font-family:helvetica;

{Font-family:helvetica;}


                Set user cannot select text
                 1, phone cannot long press Select
                 2, PC can not use the mouse to select
          
              {- Webkit-user-select:none;
                -moz-user-select:none;}
               
                  Remove the default appearance of the form, the phone, the PC can use the
               
                {appearance:none;}


Disable hyperlinks and pictures, long time popup menu

img,a{
-webkit-appearance:none;
}
            
* Set the properties of placeholder

Input:focus::-webkit-input-placeholder {
Color:blue;
Click the color of the display when you get focus */
}
Input:-ms-input-placeholder {//ie10+
Color: #999;
}
Input:-moz-placeholder {//firefox4-18
Color: #999;
}
Input::-moz-placeholder {//firefox19+
Color: #999;
}

phone-side call


<a href= "tel://18865512313" >18865512313</a>

Mobile phone Texting

<a href= "sms://8865512313" >18865512313</a>

PART-2-Responsive layout


"Three ways to use media queries"
1, directly in the CSS use:
@media type (Changxiang all/screen) and (condition 1) and (condition 2) {
CSS Selector {
CSS properties: property values;}
2, use the link Link Css,media property to set the media query mode:
<link rel= "stylesheet" href= "css/02-responsive layout. css" Media= "All and (max-width:800px)"/>
3, using import imports, directly after the URL using the Space interval media query rules:
@import URL ("css/02--responsive layout. css") All and (max-width:800px);


PART-3 Flexible layout layout

Flex Flexible Layout
1. Understand two basic concepts
(1),Container: You need to add a parent element for the Flex layout
(2),Project: Each child element in an elastic layout is called a project
2, to the use of flexible layout
(1), add to ContainerDisplay:flex; orDisplay:inline-flex;To enable container content to be displayed in a resilient layout, rather than following the way regular document flow is displayed
(2), after adding flexible layout to the container, only the container content is flexible,The way the container itself is positioned in the document flow still follows the regular document flow
(3), Display:flex; When a container is added to a flex layout, it is displayed asblock-level elements
Display:inline-flex; When the container is added as a flex layout, it is displayed asrow-level elements
(4), when set to flex layout,The float, clear, and vertical-align properties of the child elements are invalidated, but the position property remains in effect. (can still use positioning)

3, the relevant properties of the container action
(1), the Flex-direction property determines the direction of the spindle (that is, the direction of the project).
Row: Default value, spindle is horizontal, starting point on left side
Row-reverse, spindle horizontal direction, starting point at right end.
Column: The spindle is in the vertical direction, starting at the top edge.
Column-reverse: The spindle is in the vertical direction, starting at the bottom edge.
(2), Flex-wrap defines how to wrap a line if one of the axes does not fit.
NoWrap (default): No line break, each item is squeezed when the container is not wide enough
Wrap: Wrap, and the first line is at the top of the container
Wrap-reverse: NewLine, and the first line is at the bottom of the container
(3), Flex-flow: is a shorthand for the Flex-direction property and Flex-wrap property, and the default value is row nowrap
(4)The Justify-content property defines how the item is aligned on the spindle.
Note: This property is closely related to the main axis direction, the direction of the shaft is: row-beginning at left, Row-reverse beginning at right, column beginning on; Column-reverse beginning in the bottom.
Flex-start (default): Project at start of spindle
Flex-end: Project at the end of spindle
Center: Center
Space-between: Justified, the interval between items is equal. There is no interval between the opening and the final item and the container edge
Space-around: The intervals on each side of the item are equal. Therefore, the interval between items is one times larger than the interval between items and borders. (The initial and final items are spaced from the edge of the container)
(5),The Align-items property defines how the item is arranged on the intersection axis.
Flex-start: The start alignment of the intersection axis.
Flex-end: The end alignment of the intersection axis.
Center: The midpoint alignment of the intersection axis.
Baseline: The baseline alignment of the first line of text for the item. (The font size affects the baseline of each line, subject to the line height of the text)
Stretch (default): If the item is not set to height or auto, it fills the height of the entire container.
(6),The align-content attribute defines the alignment of multiple axes. If the item has only one axis, this property does not work。
Note: You can use align-content instead of Align-items when items are swapped for multiple rows.
Flex-start: Aligns with the starting point of the intersection axis.
Flex-end: Aligns with the end of the intersection axis.
Center: Aligns with the midpoint of the intersection axis.
Space-between: aligned with the intersection axis and evenly spaced between the axes.
Space-around: The intervals between each axis are equal. Therefore, the spacing between the axes is one times larger than the interval between the axes and the border.
Stretch (default): The axis fills the entire cross axis.

4, for the properties on the project
(1), the Order property defines the order in which the items are arranged. The smaller the number, the higher the alignment, and the default is 0. Common
(2), the Flex-grow property defines the magnification of the item. The default is 0, that is, if there is space left, do not zoom in.
(3), the Flex-shrink property defines the scaling of the project, the default is 1, that is, if there is not enough space, the project will shrink.
(4), Flex-basis: Defines the spindle space occupied by the project, setting this property is equivalent to setting the width of the item if the spindle is horizontal, and the original width is invalidated.
(5), Flex properties are shorthand for Flex-grow, Flex-shrink, and flex-basis, and the default value is 0 1 auto. The latter two properties are optional.
This property has two shortcut settings: auto= (1 1 Auto)/none= (0 0 Auto)
(6),The Align-self property defines how individual items are arranged on the cross axis, overwriting the Align-items property on the container, and the same property value as Align-items
The default value is auto, which inherits the properties of the parent container's align-items. (Common)

The third part-----mobile development and response style

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.