The concept and method of Adaptive Web page design

Source: Internet
Author: User
Tags html page relative

Google conducted an online lecture on the concepts and methods of adaptive web design, maintaining the same Web page code to enable the site to have a better reading experience on a variety of browsing devices (from desktop monitors to smartphones or other mobile devices), briefly collating the contents of the lecture as follows:

1, add viewport label to the HTML head.

At the beginning of the Web site HTML file, add the viewport meta tag to tell the browser that the viewport is equal to the width of the device screen, without initial scaling. The code is as follows:

This code supports chrome, Firefox, IE9 browsers, but does not support IE8 and browsers below IE8.

2, at the end of the CSS file to increase the rules for different screen resolution.

For example, use the following code, you can make the screen width of less than 480 pixels of equipment (such as the iphone, etc.), the web side of the sidebar to hide the central content bar width automatically adjusted. The following code can only be modified for z-blog,wordpress related tag names.

3, the layout width use relative width.

The overall framework of the Web page can use absolute width, but the lower content frame, sidebar, and so on are best to use relative width, so it is convenient to modify for different resolution. Of course, you can not use the relative width, it is necessary in the @media screen and (max-device-width:480px) to increase the width of each div for small screens, actually more cumbersome.

4, the page uses the relative font

Do not use an absolute font (PX) on an HTML page, but use a relative font (EM), which for most browsers is usually converted with EM = PX/16, for example, 16px equals 1em.

According to a few of the things described above, I made some changes to my blog's CSS, I found that I can browse from the iphone to experience a better page, but there is a problem is not resolved, that is, the top navigation bar navbar display a problem, after the line is covered by the following article, Do not know how to better solve this problem (update: After the user prompts, in the navigation bar Divnavbar style, join the Overflow:hidden, a line can solve this problem).

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.