Responsive Mobile Site Essentials

Source: Internet
Author: User

CSS3 There are many places in the browser is not compatible, we need to add a prefix to the browser's kernel:
Firefox browser-moz-
Google and Apple-webkit-
IE9 and above version-ms-
Open Gate-o-
Early Apple browser (Safari) Linux Konqueror need to add:-khtml-
Google 2013 has developed its own new kernel blink

Responsive Mobile Web page: "Change style sheet (media query: Allow CSS to choose whether to use the browser width, JS replacement)
; constrain viewport; flow layout (let percent write width, padding, margin) "

Event for Window object: onload loading complete; onresize resizing; onsrcoll scrolling wheel.
JS Change style sheet
<script type = "Text/javascript";
//Replace style sheet, need to be executed once when the page is loaded, and execute
Gaibian when the size of the browser changes.
Window.onresize = Gaibian;
Function Gaibian () {
var kuandu = document.documentelement.clientwidth;//width of the browser
if (kuandu>600) {
document.getElementById ("MyLink"). href= "Css/1.css";
}else{
document.getElementById ("MyLink"). href= "Css/2.css";
}
}
<script>
CSS changes style sheet by width (media query):
<link rel = "stylesheet" href = "css/1.css" type = "text/css" Media = "(min-width:800px)";
<link rel = "stylesheet" href = "css/2.css" type = "Text/css" media= "(max-width:799px) and
(min-width:600px) ";
<link rel =" stylesheet "href =" css/3.css "type =" Text/css "media=" (max-width:599px) "
Width ≥800,1.css
799 ≥ width ≥600 2.css
500 ≥ width 3.css
Media query compatibility IE9 and above, JS detection width change style sheet is IE6 also compatible with

Constrain viewport
<meta content= "Width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-
scale=1.0, User-scalable=no "name=" viewport "id=" viewport/">
A meta-meta tag with an ID and a name of viewport indicates that the viewport is now constrained. The specific constraint rules are written in the content,
Each constraint rule is separated by commas.
Width=device-width-the width of the command viewport becomes the device's width (measured in 1024x768 screen. iphone and other mobile phones
Usually varies between 320~380)
initial-scale=1.0--The default zoom level of the command viewport is 1
minimum-scale=1.0--The command viewport has a minimum zoom level of 1
maximum-scale=1.0--Command viewport maximum zoom level is 1
User-scalable=no--do not allow users to zoom the page

When the user device width is greater than 980, the use of the PC interface;
When the user device width between 620~979, using the pad interface;
When the user device width is less than 619, use the phone interface.

"Carousel Map"
With Swipe.js

Responsive Mobile Site Essentials

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.