Design the network of the mobile phone version, not to wait for a small proportion

Source: Internet
Author: User
Tags html comment website hosting

Websites are running on mobile phones, but some websites cannot be properly displayed, because these websites are intended for the TV site, if the web browser developer does not have the configuration features of the mobile phone and their website administrators, there is no way to design a convenient website on the mobile phone. The statement is simple, but it is a big project to cut down the existing network and re-port it to the machine, the author provides developers with the following four answers.

1. Share the same network with the e-commerce

In this case, the shared network with the computer refers to the direct access to the mobile phone without modifying the network used by the computer. The premise is that the elements of the website should be simplified and the layout should not be too complex.

2. website hosting for mobile phones

This practice became very popular in 1990s. At that time, the GPRS/WAP advertisements of e-companies were getting worse, and the websites that could be accessed by mobile phones were all WAP websites, that is to say, WML is a very ugly HTML, and the content is usually only text and optional.

3. Use the risk generator to determine the condition.

Opera has a desktop version and a mobile version. The same is true for Chrome, Safari, and Firefox. Some websites will use the browser sniffing mechanism (browsersniffing) to determine which browser you are using and what kind of browser, however, the browsersniffing settings are quite complex and frequent business trips. The fastest way to do this is to add different versions of links to the website so that users can freely select the desired format.

4. Develop an integrated website

A combined version of the website is a website that can be used by desktops and mobile phones at the same time. It is not the same as a shared-bandwidth website, the combined website has the same content, but it displays the page size based on the screen size. To compile a website, you only need to use CSS and HTML labels to complete it, such as HTML viewport and CSS media queries.

He Miao viewport

The Viewport refers to the "graphic interface", which is a combination of a bunch of data values. In other words, the solution is the dynamic interface you can see, it can be divided into two types: display viewport and actual viewport. For the electronic browser, viewport is less important than linear because it shows that the graphic interface is the same as the actual graphic interface.

If width = 200px in CSS, it indicates that the object is PX on the display device, but not on the phone. In CSS rules, the manufacturers can determine the number of pixel indicators to be applied to the hardware pixel. For example, the mobile phone operator may be smaller than the upper screen, the ratio is set to 0-1. 5, so the phone plane is half smaller than the actual plane.

How can this problem be solved? As long as <meta name = "viewport" content = "width = device-width"> is embedded in the HTML comment method, assign the value of actual viewport to visual viewport, in this way, the website can be completely placed into the small screen of the mobile phone. As for the CSS section, Opera proposed in this year's W3C CSS conference to add the viewport tag to CSS. If the last response passes through, you can set it directly in the CSS setting method.

He weimedia queries

Media queries is a new feature of CSS3. It integrates the two features of media type and max min-width/max min-height media type, different CSS la s can be displayed under different layout settings. For example, the screen layout is a general display area, and the print layout is the output format of the printer.

For example, if you do not want to print the website selection column, you can select different CSS display modes under media type.

In the following example, there are two types of CSS media queries layout. They are the size of the root screen to provide internal display content. When the intensity is smaller than PX, the layout of the webpage changes. For example, the sidebar moves to the lower part of the webpage rather than to the left of the main webpage ). The synchronous action changes from top to bottom, which is more powerful than the vertical operator of a mobile phone.

@ Media all and (min-width: 480px) and (max-width: 800px ){
# Container {width: auto; max-width: 800px ;}
# Main {width: 70%; float: left ;}
# Sidebar {width: 30%; float: left; margin-bottom: 10px ;}
# Pub {width: 30%; margin-left: 70%; float: none ;}@ media all and (min-width: 400px) and (max-width: 480px ){
# Container {width: auto; max-width: 480px ;}
# Main, # sidebar, # pub {width: 100%; float: none ;}
H1 {position: absolute; top: 0; height: 30px; width: 100% ;}
# Sidebar {position: absolute; top: 40px; height: 40px ;}
# Sidebar p {display: none ;}
# Sidebar ul {padding: 0; margin-top: 10px; overflow: hidden ;}
# Sidebar ul li {display: inline; font-size: 15px ;}
# Main {position: absolute; top: 80px ;}
# Pub, # footer {display: none ;}
}

Related Article

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.