源代碼
點擊運行
<!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="https://cdn.staticfile.org/foundation/5.5.3/css/foundation.min.css"> <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdn.staticfile.org/foundation/5.5.3/js/foundation.min.js"></script> <script src="https://cdn.staticfile.org/foundation/5.5.3/js/vendor/modernizr.js"></script> </head> <body style="padding:20px;"> <h2>響應式表格</h2> <p>在 div 元素上添加 overflow-x:auto 樣式,讓它支持響應式。</p> <p>重置瀏覽器窗口查看傚果 (如果空間不足會出現垂直滾動條)。</p> <div class="responsive"> <table> <thead> <tr> <th>Firstname</th> <th>Lastname</th> <th>Email</th> <th>City</th> <th>Age</th> <th>Country</th> </tr> </thead> <tbody> <tr> <td>John</td> <td>Doe</td> <td>john@example.com</td> <td>New York</td> <td>35</td> <td>USA</td> </tr> <tr> <td>Mary</td> <td>Moe</td> <td>mary@example.com</td> <td>Chicago</td> <td>51</td> <td>USA</td> </tr> <tr> <td>July</td> <td>Dooley</td> <td>july@example.com</td> <td>San Francisco</td> <td>38</td> <td>USA</td> </tr> </tbody> </table> </div> </body> </html>
運行結果