さまざまなデバイスに対応、負荷が高く、効率が低い コードが煩雑で、隠れた無駄な要素が表示され、ロード時間が長くなる 実際、これは妥協的な設計ソリューションであり、次のような影響を受けます。多くの要因があり、最適な結果とは言えません Web サイトの元のレイアウト構造がある程度変更され、ユーザーの混乱を引き起こす可能性があります
Set the computer monitor resolution (width) to be greater than or equal to 1024px (and the maximum visible width is 989px); the screen width is 480px and below for handheld devices; the screen width is 480px and placed horizontally (that is, the 480 size is parallel to the ground) handheld device;
The screen width is greater than or equal to 480px and less than 1024px and the css style of the device is placed vertically.
4. Implement responsive layout
Copy code
The code is as follows:
http:/ /css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js">> Document < style> /** The design idea is very simple. First define the fixed width under the standard browser (if the resolution of the standard browser is 1024px, then we set the width to 980px), and then use Media Query to monitor the browser Size changes. When the resolution of the browser is less than 1024px, will set the width of the page to a percentage display through the style sheet preset by Media Query. In this way, the structural elements of the sub-page will be displayed according to the browser to adjust accordingly. Similarly, when the visible area of the browser changes to a certain value (for example, 650px), The structural elements of the page are adjusted accordingly according to the cascading style sheet preset by Media Query. Check out our example: **/ /* When the browser’s visible area is less than 980px */ @media screen and (max-width: 980px) { #wrap { width: 90%; margin:0 auto;} #content {width: 60%;padding: 5%;} #sidebar {width: 30%;} #footer {padding: 8% 5%;margin-bottom: 10px;} } /* When the browser’s visible area is less than 650px */ @media screen and (max-width: 650px) { #header {height: auto;} #searchform {position: absolute;top: 5px;right: 0;} #content {width: auto; float: none; margin: 20px 0;} #sidebar {width: 100%; float: none; margin: 0;} } /**For better display effects, we often have to format the initial values of some CSS properties: ***/ /* Disable automatic font size adjustment in Safari on iPhone*/ html { -webkit-text-size-adjust: none; } /* Set HTML5 elements to blocks*/ article, aside, details, figcaption, figure, footer, header, hgroup, menu , nav, section { display: block; } /* Set adaptive adjustments such as pictures and videos*/ img { max-width: 100%; height: auto; width: auto9; /* ie8 */ } .video embed, .video object, .video iframe { width: 100%; height: auto; }