Foundation 塊狀網格
塊狀網格用於均分頁面內容:例如一行內要顯示四張圖片,不管什麼螢幕下都需要均分寬度。
可以使用<ul>
元素加上.small|medium|large-block-grid-num
類別來建立區塊狀網格。 num 用來指定均分是數量:
實例
#
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body style="padding:20px;"> <h2>Foundation 块状网格</h2> <p>图片均分屏幕宽度:</p> <ul class="small-block-grid-3"> <li><img src="newyork.jpg" alt="New York" width="400" height="300"></li> <li><img src="paris.jpg" alt="Paris" width="400" height="300"></li> <li><img src="sanfran.jpg" alt="San Francisco" width="400" height="300"></li> </ul> </body> </html>
執行實例»
點擊"運行實例" 按鈕查看線上實例
另一個實例,使用段落:
實例
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body style="padding:20px;"> <h2>Foundation 块状网格</h2> <p>均分段落:</p> <ul class="small-block-grid-3"> <li><p>Just a Simple Example Text...</p></li> <li><p>Just a Simple Example Text...</p></li> <li><p>Just a Simple Example Text...</p></li> </ul> </body> </html>
執行實例»
點擊"運行實例" 按鈕查看線上實例
#不同尺寸螢幕顯示不同數量
透過新增多個網格區塊類別可以設定不同尺寸螢幕顯示不同的區塊數量:
##實例
運行實例»點擊"運行實例" 按鈕查看線上實例
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body style="padding:20px;"> <h2>Foundation 块状网格</h2> <p>通过添加多个块类,在不同屏幕指定不同是均分数量:</p> <ul class="small-block-grid-2 medium-block-grid-3 large-block-grid-4"> <li><img src="newyork.jpg" alt="New York" width="400" height="300"></li> <li><img src="paris.jpg" alt="Paris" width="400" height="300"></li> <li><img src="sanfran.jpg" alt="San Francisco" width="400" height="300"></li> <li><img src="newyork.jpg" alt="New York" width="400" height="300"></li> </ul> </body> </html>
運行實例»點擊"運行實例" 按鈕查看線上實例
#