?
This document uses PHP Chinese website manual Release
什么是響應式網(wǎng)頁設計? 響應式Web設計(Responsive Web design)的理念是: 頁面的設計與開發(fā)應當根據(jù)用戶行為以及設備環(huán)境(系統(tǒng)平臺、屏幕尺寸、屏幕定向等)進行相應的響應和調整。 |
你可以通過以下兩種方式來獲取 Foundation:
1、頁面下方下載最新版本。
2、使用手冊網(wǎng)教程官網(wǎng)提供的CDN(推薦):
<!--?css?文件?--> <link?rel="stylesheet"?> <!--?jQuery?庫?--> <script?src="http://ku.shouce.ren/libs/jquery/2/jquery2.0.3.min.js"></script> <!--?JavaScript?文件?--> <script?src="http://ku.shouce.ren/libs/foundation/5.5.3/foundation.min.js"></script> <!--?modernizr?文件?--> <script?src="http://ku.shouce.ren/libs/foundation/5.5.3/modernizr.js"></script>
本站靜態(tài) CDN 基于阿里云服務。
Foundation 使用 CDN 的優(yōu)勢: Foundation 使用 CDN 提高了企業(yè)站點(尤其含有大量圖片和靜態(tài)頁面站點)的訪問速度,并大大提高以上性質站點的穩(wěn)定性 為什么使用 modernizr? Some ?Foundation 的組件使用了比較前前沿的 HTML5 和 CSS3 特性,但不是所有瀏覽器都支持。 Modernizr 是一個用于檢測用戶瀏覽器HTML5和CSS3特性的JavaScript庫 - 讓組件能在所有瀏覽器上正常運行。 |
1. 添加 HTML5 doctype
Foundation 使用 HTML 元素和 CSS 屬性,所以需要添加 HTML5 doctype 文檔類型聲明。
同時我們可以設置文檔的語言屬性 lang 及字符編碼:
<!DOCTYPE?html> <html?lang="zh-cn"> ??<head> ???????<meta?charset="utf-8">? ??</head> </html>
?
2. Foundation 5 移動優(yōu)先
Foundation 5 為移動設備的響應式設計??蚣艿暮诵氖且苿觾?yōu)先。
為了確保頁面可自由縮放可以在 <head>
元素中添加以下 <meta>
標簽:
<meta?name="viewport"?content="width=device-width,?initial-scale=1">
3. 初始化組件
一些 Foundation 組件是基于 jQuery 開放的,如:模態(tài)框、下拉菜單等。你可以使用以下腳本來初始化組件:
<script> $(document).ready(function()?{ ???????$(document).foundation(); }) </script>
?
如何創(chuàng)建一個基本的 foundation 頁面:
<!DOCTYPE?html> <html> <head> ??<title>Foundation?Example</title> ??<meta?charset="utf-8"> ??<meta?name="viewport"?content="width=device-width,?initial-scale=1"> ??<!--?css?文件?--> ??<link?rel="stylesheet"?> ??<!--?jQuery?庫?--> ??<script?src="http://ku.shouce.ren/libs/jquery/2/jquery2.0.3.min.js"></script> ??<!--?JavaScript?文件?--> ??<script?src="http://ku.shouce.ren/libs/foundation/5.5.3/foundation.min.js"></script> ??<!--?modernizr?文件?--> ??<script?src="http://ku.shouce.ren/libs/foundation/5.5.3/modernizr.js"></script> </head> <body> ? <div?class="row"> ??<div?class="medium-12?columns"> ????<div?class="panel"> ??????<h1>Foundation?頁面</h1> ??????<p>重置窗口大小,查看效果!</p> ??????<button?type="button"?class="button?small">I?Like?It!</button> ????</div> ??</div> </div> <div?class="row"> ??<div?class="medium-4?columns"> ????<h3>Column?1</h3> ????<p>Lorem?ipsum?lorem?ipsum?lorem?ipsum?lorem?ipsum?lorem?ipsum?lorem?ipsum?lorem?ipsum..</p> ??</div> ??<div?class="medium-4?columns"> ????<h3>Column?2</h3> ????<p>Lorem?ipsum?lorem?ipsum?lorem?ipsum?lorem?ipsum?lorem?ipsum?lorem?ipsum?lorem?ipsum..</p> ??</div> ??<div?class="medium-4?columns"> ????<h3>Column?3</h3> ????<p>Lorem?ipsum?lorem?ipsum?lorem?ipsum?lorem?ipsum?lorem?ipsum?lorem?ipsum?lorem?ipsum..</p> ??</div> </div> </body> </html>
實例預覽 ?
關于我們 聯(lián)系我們 留言板
手冊網(wǎng)