Chinesisches Grundlagenhandbuch
/ Foundation 表格
Foundation 表格
Foundation 的 <table>
元素样式为灰色斑马条纹且包含四个边框:
实例
<!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>基本表格</h2> <p>Foundation 的 table 元素样式为灰色斑马条纹且包含四个边框:</p> <table> <thead> <tr> <th>Firstname</th> <th>Lastname</th> <th>Email</th> </tr> </thead> <tbody> <tr> <td>John</td> <td>Doe</td> <td>john@example.com</td> </tr> <tr> <td>Mary</td> <td>Moe</td> <td>mary@example.com</td> </tr> <tr> <td>July</td> <td>Dooley</td> <td>july@example.com</td> </tr> </tbody> </table> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例
响应式表格
使用 CSS 让表格支持响应式设计:在表格外添加 <div>
元素,样式为 overflow-x:hidden
:
实例
<!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>响应式表格</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>
运行实例 »
点击 "运行实例" 按钮查看在线实例